Handle refunds
Refund all or part of a payment, track the status, and reconcile refunds in your accounting.
8 min read
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.xxxx" \
-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.xxxx" \
-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.succeededeventThe refund has completed (full or partial).
{
"id": "evt_Rfd001",
"type": "refund.succeeded",
"data": {
"id": "rfd_01JXXXXXXXXXXXXX",
"payment": "trx_01JXXXXXXXXXXXXX",
"amount": 2000,
"status": "succeeded"
}
}Edge cases
Provider delaynoteoptionalDepending on the Mobile Money operator, crediting the customer may take from a few minutes to a few hours.
SplitsnoteoptionalFor an installment (split) payment, each captured tranche can only be refunded once it has succeeded.
Check the status before refunding
Only succeeded payments can be refunded. Attempting to refund a
pending or already fully refunded payment returns an error — handle these cases in your
support UI.