API flow to refund against a payment transaction made through PhonePe. A full or partial refund is possible against a transaction.

Request Headers

Header NameHeader Value
Content-Typeapplication/json
X-VERIFYSHA256(base64 encoded payload +"/v3/credit/backToSource" + salt key) + ### + salt index
{
    "merchantId": "DemoMerchant",
    "transactionId": "TX123456789",
    "providerReferenceId": "PPXXXXX",
    "amount": 100,
    "merchantOrderId": "OD1234",
    "subMerchant": "DemoMerchant",
    "message": "refund for cancelled order"
}
{
  "request": "eyJtZXJjaGFudE9yZGVySWQiOiAiT0QxMjM0IiwgInN1Yk1lcmNoYW50IjogIkRlbW9NZXJjaGFudCIsICJhbW91bnQiOiAxMDAsICJtZXNzYWdlIjogInJlZnVuZCBmb3IgY2FuY2VsbGVkIG9yZGVyIiwgIm1vYmlsZU51bWJlciI6ICI5eHh4eHh4eHh4IiwgInNob3J0TmFtZSI6ICJBbWl0IiwgInRyYW5zYWN0aW9uSWQiOiAiVFgxMjM0NTY3ODkiLCAibWVyY2hhbnRVc2VySWQiOiAiVTEyMzQ1Njc4OSIsICJtZXJjaGFudElkIjogIkRlbW9NZXJjaGFudCIsICJlbWFpbCI6ICJhbWl0eHh4NzVAZ21haWwuY29tIn0"
}

Request Parameters

Parameter NameDescription
merchantId
String
Mandatory
Unique Merchant ID assigned to the merchant by PhonePe
transactionId
String
Mandatory
Unique Transaction ID generated by the merchant to track this request to PhonePe.
This should be different from transaction ID of debit transaction.
originalTransactionId
String
Mandatory
Merchant transaction Id of forward transaction which needs to be reversed.
providerReferenceId*
String
Mandatory
PhonePe transaction id of the original forward payment.
Note : use only one of originalTransactionId, providerReferenceId only
amount
Long
Mandatory
Reversal amount in paise. Upto a max of amount of original payment transaction.
merchantOrderId
String
Mandatory
Order ID for the merchant transaction
subMerchant
String
Optional
Tag to categorize merchant transaction
message
String
Mandatory
Short message

Response Parameters

Parameter NameDescription
success
Boolean
Success status of the request
code
Enum
See list of response codes below
message
String
Short message about code
transactionId
String
Unique Transaction ID generated by the merchant to track this request to PhonePe
merchantId
String
Unique Merchant ID assigned to the merchant by PhonePe
amount
Long
Transaction amount in paise
status
String
Status of the request
mobileNumber
String
Mobile number of the user
providerReferenceId
String
PhonePe payment transaction id against which the reversal is to be done
payResponseCode
String
PhonePe internal status code

Refund API Response Codes

CodeDescription
BAD_REQUESTInvalid request
AUTHORIZATION_FAILEDX-VERIFY header is incorrect
TRANSACTION_NOT_FOUNDOriginal transaction not found
INTERNAL_SERVER_ERRORSomething went wrong. Refund might get initiated (need to check status with check transaction status API before retrying the refund)
PAYMENT_SUCCESSPayment is successful
PAYMENT_ERRORPayment failed
PAYMENT_PENDINGPayment is pending. It does not indicate failed payment. Refund might get initiated (need to check status with check transaction status API before retrying the refund)
TIMED_OUTRefund timed out. Refund might get initiated (need to check status with check transaction status API before retrying the refund)
DUPLICATE_TXN_REQUESTIf the transaction id is used already for refund request.
EXCESS_REFUND_AMOUNT If the amount requested for refund is more than forward payment or If refund is already done
WALLLET_NOT_ACTIVATED If the user has disabled the wallet. Contact user to know the source for refund.
Language
Click Try It! to start a request and see the response here!