The Refund Transaction for Partner integration can be used for the following purposes:
- Cancel a transaction that is in ‘auth’ state at the moment
- Refund a transaction that is in a ‘captured’ state at the moment.
Request parameters
Parameter | Description | Example |
---|---|---|
token mandatory | String The refund ID must be specified in this parameter.Char limit : 23 characters | test_ref_0001 |
payu_id mandatory | String Partner should pass the payu_id of the payment transaction for which the refund request is being raised. | 403993715529606983 |
amount mandatory | String This parameter must contain less than or equal to the actual amount for the payment transaction done. | 500 |
reseller_id mandatory | String This parameter must contain the WhatsApp’s reseller UUID | 1212312213 |
merchant_id mandatory | String This parameter must contain the MID of the merchant | 8238480 |
hash mandatory | String This parameter must contain the hash value to be calculated at your end. Following are the strings used for calculating the hash:sha512(merchant_id|refund_id|amount|client_secret) For more information on sha512, refer to API Authentication and Security. | 2a04a44ed058ca724a 17b4e4d4639aa15254a 343e0 |
Sample request
curl --location 'http://localhost:8080/apilayer/partner/refunds' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 8c9177c718fc77046efe0d18192b98cadf798f2a136f2d31c7e09d60797403b5' \
--data '{
"refund_id": "test_ref_0001",
"payu_id": 403993715529606983,
"merchant_id": "8238480",
"reseller_id": "1212312213",
"hash": "8t7qweyuigadhsc8317",
"amount": 23.124
}'
Response parameters
Parameter | Fields | Sample Value |
---|---|---|
status | String The status can be any of the following:- 1 if API call is a success - 0 if the API has failed | 1 |
msg | String This parameter contains a response message description. | Refund Request Queued |
request_id | String This parameter contains a unique refund ID generated by PayU. | 6582898821 |
bank_ref_num | String This parameter contains a bank reference number is returned from bank. | IRN6601148 |
mihpayid | String This parameter contains a unique transaction ID generated by PayU during sale. For more information on mihpayid, refer to Post Parameters. | 7043873219 |
error_code | String This parameter contains the code for response. For a list of error codes and their description, refer to Refund Error Codes. | 102 |
Sample response
Success scenario
{
"status": 1,
"msg": "Refund Request Queued",
"request_id": "12486538355",
"bank_ref_num": null,
"mihpayid": 17787245459,
"error_code": 102
}
Failure scenarios
- Invalid partner
- Error code=400
{
"message": "Partner with UUID 1212312213r is not allowed to do this action"
}
- Invalid auth token
- Error code=401
{
"message": "Invalid Auth token"
}
- Invalid Hash
- Error code=403
{
"message": "Invalid Hash"
}
- Refund request already exists
- Error code=200
{ "message": "refund request already exists for test_ref_0010" }
- Other possible responses:
- Error code=400
Failure Reason | Sample Response |
---|---|
Transaction with same amount and token | { "status": 0, "msg": "Refund FAILURE - Transactions with same amount and same token not allowed", "error_code": 227, "mihpayid": 403993715529339129 } |
Two refunds of same amount for same transaction within 5 minutes | { "status": 0, "msg": "Refund FAILURE - Two refunds of same amount for same transaction within 5 minutes are not allowed", "error_code": 214, "mihpayid": 17788074728 } |
Invalid amount | { "status": 0, "msg": "Refund FAILURE - Invalid amount", "error_code": 105, "mihpayid": 17842967667 } |
Transaction does not exist | { "status": 0, "msg": "transaction does not exists", "mihpayid": "" } |
If refund token already exists | {"status":0,"msg":"Refund FAILURE - Token already exists.","error_code":106,"mihpayid":403993715529339129} |
If request cannot be processed | { "status": "Refund request cannot be processed" } |
Invalid partner | {"status":0,"msg":"Invalid partner.","error_code":106,"mihpayid":403993715529339129} |