Refund API technical guide

A detailed overview of the API endpoints for Refund API, with its purpose, authentication requirements, request structure, and expected responses.

API URLs

Depending on the environment, use one of the following URLs:

Authentication

Endpoint: Get Authentication Token

This endpoint provides a token for authenticating API requests. The token is required for calling other endpoints, such as the Refund API.

Request headers

Header Type Description Required
Authorisation String The merchant ID as username Yes

 

Sample cURL request

curl --location '/merchant/get_token' \ 
--header 'Authorization: MERCHANT_ID

Example response

{ 
"status": 1,
"msg": "Token generated successfully",
"data": {
"token":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9maWxlX2lkIjoiMjUyMTY
zNDg2NTAxNTQ2IiwiZXhwIjoxNzM1MTkxODk0fQ.8G8NEoYRQR38WOBVgIdzkeMwq
arc4-_IaFbRNqAyM8A"
}
}

Refund API

This endpoint allows merchants to create a refund request for a specific transaction.

Request headers

Using the token

This token received from the authentication API must be included in the 'Authorisation' header for subsequent requests. Format the header as follows:

Authorization: Bearer <token>

Replace '<token>' with the value received from the authentication API.

Request body

The request body must be sent in JSON format and include the following parameters:

Parameter Type Description Required
transaction_reference String

The unique reference ID for the transaction.

Yes
refund_amount String The amount to be refunded. Yes

Example request body

{
"transaction_reference": "1729057564864250",
"refund_amount": "2"
}

Sample cURL request

curl -X POST \ 
<API_URL>/merchant_service/create_refund_request \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{
"transaction_reference": "1729057564864250",
"refund_amount": "2"
}'

Response

Example response for valid request

{ 
"status": 1,
"msg": "Refund Request Created",
"data": {
"transaction_reference": "1729057564864250",
"refund": {
"refund_reference_no": "234771737086157",
"amount": "2.00",
"type": "FULL_REFUND",
"status": "pending_approval",
"message": "", "approval_code": ""
}
}
}

Example responses for invalid request

{ 
"status": 0,
"msg": "Transaction does not exist for merchant Faizah
Merchant",
"data": []
}
{ 
"status": 0,
"msg": "Refund request for transaction reference
1660290407261234 already exist.",
"data": []
}
{ 
"status": 0,
"msg": "Partial refund is not supported.",
"data": []
}
{ 
"status": 0,
"msg": "Requested refund amount exceeds transaction amount.",
"data": []
}
{ 
"status": 0,
"msg": "Transaction date exceeds allowed refund window: 180
days.",
"data": []
}
{ 
"status": 0,
"msg": "Authentication Failed",
"data": []
}