WePay.checkoutRefund()

Refunds the payment associated with the checkout created by the application. Checkout must be in "captured" state.

Refunds the payment associated with the checkout created by the application. Checkout must be in "captured" state.

Usage

Hover over inputs/exits for more info.

var WePay = require('machinepack-wepay');


// Refunds the payment associated with the checkout created by the application. Checkout must be in "captured" state.

WePay.checkoutRefund({

accessToken: '604f39f41e364951ced74070c6e8bfa49d346cdfee6191b03c2c2d9c9cda9184',

checkoutId: 1548718026,

refundReason: 'Accidental payment',

amount: 4.99,

appFee: 1.99,

payerEmailMessage: 'Here is your refund.',

payeeEmailMessage: 'A refund was issued.',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

accessToken required

The string access token of the user issuing the checkout refund.

'604f39f41e364951ced74070c6e8bfa49d346cdfee6191b03c2c2d9c9cda9184'
checkoutId required

The unique ID of the checkout you want to refund.

1548718026
refundReason required

The reason the payment is being refunded.

'Accidental payment'
amount

The total amount that will be refunded back to the payer.

4.99
appFee

The portion of the "amount" that will be refunded as an app_fee refund.

1.99
payerEmailMessage

A short message that will be included in the payment refund email to the payer.

'Here is your refund.'
payeeEmailMessage

A short message that will be included in the payment refund email to the payee.

'A refund was issued.'

Exits

error

An unexpected error occurred.

success

OK.

{ checkout_id: 12345, state: 'refunded' }