Refund API


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

Header NameHeader Value
Content-Typeapplication/json
X-VERIFYSHA256(base64 encoded payload +”/v3/credit/backToSource” + salt key) + ### + salt index
Sample Payload for Base64
{
    "merchantId": "MERCHANTUAT",
    "transactionId": "TX123456789001",
    "originalTransactionId": "TX123456XXXXX00",
    "amount": 100,
    "merchantOrderId": "OD1234",
    "subMerchant": "DemoMerchant",
    "message": "refund for cancelled order"
}
Sample Request
{
  "request": "ewogICAgIm1lcmNoYW50SWQiOiAiRGVtb01lcmNoYW50IiwKICAgICJ0cmFuc2FjdGlvbklkIjogIlRYMTIzNDU2Nzg5IiwKICAgICJwcm92aWRlclJlZmVyZW5jZUlkIjogIlQyWFhYWFhYWFhYWFgiLAogICAgImFtb3VudCI6IDEwMCwKICAgICJtZXNzYWdlIjogInJlZnVuZCBmb3IgY2FuY2VsbGVkIG9yZGVyIgp9"
}
Parameter NameType Description Mandatory
merchantId StringUnique Merchant ID assigned to the merchant by PhonePe Yes
transactionId StringUnique Transaction ID created by merchant to track the refund request to PhonePe.
This should be different from transaction ID of forward transaction.
  Yes
originalTransactionId StringTransaction Id of forward transaction which needs to be reversed/refunded. You will get the details in the payload of Callback or Transaction_List API.  Yes
providerReferenceId StringPhonePe transaction Id of the original or forward payment.
Note : You can use either the originalTransactionId or providerReferenceId.
  Yes
amount LongReversal amount in paise. Upto a max of amount of original payment transaction.  Yes
message_String Short message  Yes
Parameter NameType Description
successBoolean Success status of the request
code EnumSee list of response codes below
message StringShort message about code
transactionId StringUnique Transaction ID generated by the merchant to track this request to PhonePe
merchantId StringUnique Merchant ID assigned to the merchant by PhonePe
amount LongTransaction amount in paise
status StringStatus of the request
providerReferenceId StringPhonePe payment transaction id against which the reversal is to be done
payResponseCode StringPhonePe internal status code
CodeDescription
BAD_REQUESTInvalid request
AUTHORIZATION_FAILEDX-VERIFY header is incorrect
TRANSACTION_NOT_FOUNDOriginal transaction not found. Possibly the transaction ID is incorrect or the forward payment was not successful.
INTERNAL_SERVER_ERRORSomething went wrong. Refund might get initiated (need to do 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_AMOUNTIf the amount requested for refund is more than forward payment or If refund is already done
WALLLET_NOT_ACTIVATEDIf the user has disabled the wallet. Contact user to know the source for refund.
Is this article helpful?