Refund Order

Create a refund for an Order. Refunds can be initiated only for transactions that are CHARGED.

The response of refund initiation is similar to that of order status API Response with the addition of refund block.
The fields and description in refund block is given below

FieldsDescription
unique_request_idThe unique request id that is passed during refund initiation. Do not pass any special characters.
statusThe status of the refund initiated. Initial status will always be PENDING
sent_to_gatewayThe flag denotes if the refund was initiated to gateway. The initial status is always false, as refunds are queued at juspay for a max of 15minutes.
refund_typeThe type of refund. Values can be STANDARD, INSTANT
refund_sourceThe name of gateway
refThe refund id provided by the PG
initiated_byThe source of initiation.
idThe reference id provided by PG, if not available then its mapped to unique request id.
error_messageThe error message provided by the PG
error_codeThe error code provided by the PG
amountThe refund amount passed in the request
createdThe timestamp of refund creation

Refund API failure with response code

ReasonResponseResponse code
Duplicate unique_request_id{
"status_id": -1,
"status": "ERROR",
"error_message": "A refund call was already completed with this unique_request_id for the order.",
"error_code": "duplicate.call"
}
400
Duplicate Refund Request within 2 seconds{"status_id":"-1","status":"ERROR","error_message":"A refund call was already processing with this amount for the order.","error_code":"duplicate.call"}400
Refund amount greater than refundable{
"status_id": -1,
"status": "ERROR",
"error_message": "Refund amount exceeds the refundable amount.",
"error_code": "invalid.amount.exceeded"
}
400
Amount/unique_request_id not passed{
"status": "Bad Request",
"error_message": "Mandatory fields are missing",
"error_code": "Mandatory fields are missing"
}
400
Refund Amount is 0{
"status_id": -1,
"status": "ERROR",
"error_message": "Amount is invalid.",
"error_code": "invalid amount"
}
400
Invalid Order id{
"status_id": 40,
"status": "NOT_FOUND",
"order_id": "66721145_keexeV8cNyb7DrYzs"
}
400
Unsuccessful order{
"status_id": -1,
"status": "ERROR",
"error_message": "Cannot process unsuccessful order.",
"error_code": "invalid.order.not_successful"
}
400
Invalid Authentication{
"status": "error",
"error_code": "access_denied"
}
401
Language
Authentication
Basic
base64
:
Click Try It! to start a request and see the response here!