Handle refunds
Refund all or part of a payment, track the status, and reconcile refunds in your accounting.
A refund sends back to the customer all or part of a succeeded payment. This is a sensitive
operation: the private key is required.
Full refund
curl https://api.wajub.com/refunds \
-H "Authorization: sk_test.2a7c5e91b0d34f68" \
-d '{ "payment": "trx_01JXXXXXXXXXXXXX", "reason": "requested_by_customer" }'Partial refund
Specify an amount less than the paid amount. Multiple partial refunds are possible
as long as their sum does not exceed the total. reason is required (one of a fixed
enum — see Refunds).
curl https://api.wajub.com/refunds \
-H "Authorization: sk_test.2a7c5e91b0d34f68" \
-d '{ "payment": "trx_01JXXXXXXXXXXXXX", "amount": 2000, "reason": "product_not_received" }'Track the status
The refund is asynchronous. Listen for refund.succeeded (and refund.failed,
refund.cancelled for the unhappy paths):
refund.succeededevent{
"id": "evt_Rfd001",
"type": "refund.succeeded",
"data": {
"id": "rfd_01JXXXXXXXXXXXXX",
"payment": "trx_01JXXXXXXXXXXXXX",
"amount": 2000,
"status": "succeeded"
}
}Edge cases
Provider delaynoteoptionalSplitsnoteoptionalCheck the status before refunding
Only succeeded payments can be refunded. Attempting to refund apending
or already fully refunded payment returns an error — handle these cases in your support UI.
Was this page helpful?