Skip to main content

Refunds

Overview

To process a refund, you can use the POST /api/refund/:key endpoint.

The endpoint requires a X-API-KEY header with your API key.

The key can be the reference field that is returned when you create a payment intent, or the key field that you set when you create a payment intent.

POST /api/refund/{key}
POST https://pay.little.africa/api/refund/{key}
Request:
{
"amount": 0,
"callbackUrl": "https://yourwebsite.com/callback",
"reason": "Refund for order 123"
}

callbackUrl is an optional field that indicates the URL that will be called when the refund is completed. The callback will only be called for requests that return a PENDING status.

reason is an optional field that indicates the reason for the refund.

Response:
{
"date": "2024-05-13T06:39:27.311Z",
"data": {
"status": "COMPLETED",
"message": "Success"
}
}

The possible values for status are COMPLETED ,FAILED and PENDING.

Callback payload:

Response:
{
"status": "COMPLETED",
"message": "Success",
"amount": 0,
"reason": "Refund for order 123",
"date": "2024-05-13T06:39:27.311Z",
"reference": "1cbfffbc-b365-45f6-9e5d-13e445c125cd",
"key": "1234"
}