Initiate Refund – COD

This API is used to refund to the customer where the payment transaction is missing in the system.
E.g. For payment made through Cash-On-Delivery, the forward payment is made through cash and not on PhonePe. The merchant can initiate a refund through Deferred Credit.

Deferred credit is a two-step process.
First, the merchant initiates the call to /credit/deferred for credit request.
Second, to fulfill the deferred request, the merchant calls Credit Deferred Fulfil

<html-block html=”

Request Headers

“>

Header NameHeader Values
Content-Typeapplication/json
X-VERIFYSHA256(base64 encoded payload + “/v3/credit/deferred” +
salt key) + ### + salt index
X-CALLBACK-URLDynamic callback URI for the API request
{
  "merchantId": "DemoMerchant",
  "transactionId": "TX123456789",
  "merchantUserId": "U123456789",
  "amount": 100,
  "merchantOrderId": "OD1234",
  "subMerchant": "DemoMerchant",
  "mobileNumber": "9xxxxxxxxx",
  "message": "refund for cancelled order",
  "email": "[email protected]",
  "shortName": "Amit"
}
{
  "request": "eyJtZXJjaGFudE9yZGVySWQiOiAiT0QxMjM0IiwgInN1Yk1lcmNoYW50IjogIkRlbW9NZXJjaGFudCIsICJhbW91bnQiOiAxMDAsICJtZXNzYWdlIjogInJlZnVuZCBmb3IgY2FuY2VsbGVkIG9yZGVyIiwgIm1vYmlsZU51bWJlciI6ICI5eHh4eHh4eHh4IiwgInNob3J0TmFtZSI6ICJBbWl0IiwgInRyYW5zYWN0aW9uSWQiOiAiVFgxMjM0NTY3ODkiLCAibWVyY2hhbnRVc2VySWQiOiAiVTEyMzQ1Njc4OSIsICJtZXJjaGFudElkIjogIkRlbW9NZXJjaGFudCIsICJlbWFpbCI6ICJhbWl0eHh4NzVAZ21haWwuY29tIn0"
}

<html-block html=”

Request Parameters

“>

Parameter NameTypeDescriptionMandatory
merchantIdStringUnique Merchant ID assigned to the merchant by PhonePeYes
transactionIdStringUnique Transaction ID generated by the merchant to track this request to PhonePeYes
merchantUserIdStringUnique ID assigned to the user by the merchant. This is used for linking the user’s PhonePe account.Yes
amountLongTransaction amount in paiseYes
merchantOrderIdStringOrder ID for the merchant transactionYes
subMerchantStringTag to categorize merchant transactionNo
mobileNumberStringMobile number of the userNo
messageStringShort messageNo
emailStringEmail address of the userNo
shortNameStringUser’s name pre-filled for registration purpose.No

<html-block html=”

Response Parameters

“>

Parameter NameTypeDescription
successBooleanSuccess status of the request
codeENUMTo see list of response codes go here.
messageStringShort message about code

{“method”:”post”,”url”:”/v3/credit/deferred”,”auth”:”never”,”apiSetting”:”5ecf9143b5bd210023b3b738″,”examples”:{“codes”:[]},”results”:{“codes”:[{“status”:302,”name”:”Success Response”,”language”:”json”,”code”:”{}\n “},{“name”:”Failure Response”,”status”:400,”language”:”json”,”code”:”{\n \”success\”: false,\n \”code\”: \”INVALID_TRANSACTION_ID\”,\n \”message\”: \”The transaction id you have entered seems to be invalid.\”,\n \”data\”: {}\n}”}]},”params”:[{“name”:”Content-Type”,”type”:”string”,”enumValues”:””,”default”:”application/json”,”desc”:””,”required”:true,”in”:”header”,”ref”:””,”_id”:”5a16b4af9610050012c4a4e7″},{“name”:”X-VERIFY”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”SHA256(base64 encoded payload + \”/v3/credit/deferred\” + salt key) + ### + salt index”,”required”:true,”in”:”header”,”ref”:””,”_id”:”5a16b4af9610050012c4a4e6″},{“name”:”X-CALLBACK-URL”,”type”:”string”,”enumValues”:””,”default”:”https://www.demoMerchant.com/callback”,”desc”:”Dynamic callback URI for the API request”,”required”:true,”in”:”header”,”ref”:””,”_id”:”5a16b65638e7e0001281848c”},{“name”:”request”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”base64 encoded payload”,”required”:true,”in”:”body”,”ref”:””,”_id”:”5a180d81620d9b001cb7172f”}]}
https://mercury-uat.phonepe.com