API flow to refund against a payment transaction made through PhonePe. A full or partial refund is possible against a transaction.
Header Name | Header Value |
---|---|
| application/json |
| SHA256(base64 encoded payload + "/v3/credit/backToSource" + salt key) + ### + salt index |
{
"merchantId": "UATMERCHANT",
"transactionId": "TX123456789",
"providerReferenceId": "PPXXXXX",
"amount": 100,
"merchantOrderId": "OD1234",
"subMerchantId": "DemoMerchant",
"message": "refund for cancelled order"
}
{
"request": "ewogICAgIm1lcmNoYW50SWQiOiAiVUFUTUVSQ0hBTlQiLAogICAgInRyYW5zYWN0aW9uSWQiOiAiVFgxMjM0NTY3ODkiLAogICAgInByb3ZpZGVyUmVmZXJlbmNlSWQiOiAiUFBYWFhYWCIsCiAgICAiYW1vdW50IjogMTAwLAogICAgIm1lcmNoYW50T3JkZXJJZCI6ICJPRDEyMzQiLAogICAgInN1Yk1lcmNoYW50SWQiOiAiRGVtb01lcmNoYW50IiwKICAgICJtZXNzYWdlIjogInJlZnVuZCBmb3IgY2FuY2VsbGVkIG9yZGVyIgp9"
}
Parameter Name | Type | Description | Mandatory |
---|---|---|---|
merchantId | STRING | Unique Merchant ID assigned to the merchant by PhonePe |
|
transactionId | STRING | Unique Transaction ID generated by the merchant to track this request to PhonePe. |
|
originalTransactionId | STRING | Merchant transaction Id of forward transaction which needs to be reversed. |
|
providerReferenceId | STRING | PhonePe transaction id of the original forward payment. |
|
amount | LONG | Reversal amount in paise. Upto a max of amount of original payment transaction. |
|
merchantOrderId | STRING | Order ID for the merchant transaction |
|
subMerchantId | STRING | Tag to categorize merchant transaction |
|
message | STRING | Short message |
|
Parameter Name | Type | Description |
---|---|---|
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 |
Code | Description |
---|---|
BAD_REQUEST | Invalid request |
AUTHORIZATION_FAILED | X-VERIFY header is incorrect |
TRANSACTION_NOT_FOUND | Original transaction not found |
INTERNAL_SERVER_ERROR | Something went wrong. Refund might get initiated (need to check status with check transaction status API before retrying the refund) |
PAYMENT_SUCCESS | Payment is successful |
PAYMENT_ERROR | Payment failed |
PAYMENT_PENDING | Payment 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_OUT | Refund timed out. Refund might get initiated (need to check status with check transaction status API before retrying the refund) |
REVERSAL_WINDOW_EXCEEDED | The time window for refunding the transaction has been breached. Please process the refund manually |
Code | payResponseCode | Description |
---|---|---|
PAYMENT_ERROR | DUPLICATE_TXN_REQUEST | If the transaction id is used already for refund request. |
PAYMENT_ERROR | EXCESS_REFUND_AMOUNT | If the amount requested for refund is more than forward payment or If refund is already done |
PAYMENT_ERROR | WALLET_NOT_ACTIVATED | If the user has disabled the wallet. Contact user to know the source for refund. |
REVERSAL_WINDOW_EXCEEDED | EXTERNAL_WALLET_REVERSAL_WINDOW_BREACHED | Maximum time period for refunding the transaction is breached |
REVERSAL_WINDOW_EXCEEDED | PG_REVERSAL_WINDOW_EXCEEDED | Maximum time period for refunding the transaction is breached |
REVERSAL_WINDOW_EXCEEDED | ACCOUNT_REVERSAL_WINDOW_EXCEEDED | Maximum time period for refunding the transaction is breached |