Skip to main content

Refund

Use the Refund API to process a refund transaction securely. This API can be used to refund the full or partial amount of the original transaction.

POSTbaseUrl/api/v1/transactions/refund

Headers

  • Authorization: Bearer {{accessToken}} (Include the token obtained from the Authentication API)
  • Content-Type: application/json

Send a JSON object with the following fields:

FieldTypeRequiredDescription
amountstringYesThe amount to be processed. Must be a whole number, no decimals are allowed.
transactionIdstringYesThe unique identifier of the original transaction to be refunded.
refNumberstringYesA unique reference number for tracking (ECR reference number)

Note: The transactionId field value can be found on the original transaction purchase API response. The refNumber field should be a new, unique value generated by the user to track the refund transaction.

Example Request

{
"amount": "12000",
"transactionId": "1004",
"refNumber": "refNumber"
}

Error Handling

If the transaction fails, you may receive an error response.

Example Error

{
"status": "failed",
"msg": "Insufficient Funds"
}
Error ScenarioAPI Response MessageHTTP Status
Invalid TokenAuthentication failed. Invalid or expired token.401 Unauthorized
Refund amount exceeds limitRefund amount exceeds the allowed limit.400 Bad Request
Invalid endpointEndpoint not found - Verify the API URL404 NOT FOUND.

Usage Tips

  1. Match Original Transaction: Ensure the transactionId provided maps to an existing transaction eligible for refund.
  2. Reference Number: Use unique refNumber values for each transaction to prevent duplicate processing.
  3. Transaction Id: Use the integer value with the same name retrieved from the purchase API response of the original transaction.