Hey! These docs are for version 3.2, which is no longer officially supported. Click here for the latest version, 1.0!

Refund Order

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

If successful, the response of the Refund Order API is an Order Object, which is similar to that of the  /order/status API Response, but with the addition of a  refunds block. The  refunds block is an array of Refund Objects, with details or each refund:
    Returns:  Order Object       (see table)
Refunds block  (contained in Order Object)       (click to view)
Refunds: [{...},{...},..]
Array of
An array of Refund Objects with details of each refund (returned in the Refunds Object only for the Refund Order and Get Order Status API).
Parameters for each object in the refunds array:     (click to open)
unique_request_idStringThe unique request ID that is passed during refund initiation. Do not pass any special characters.
statusStringThe status of the refund initiated. Initial status will always be PENDING
  Status codes and meaning
     This means that the refund has been successfully
     This would mean that the refund has been queued
     withJusPay or with the downstream system.
     We were unable to process the refund successfully.
     You have to try again with a new unique_request_id.
     This would mean that the refund request was sent an
     ambigious response from the payment gateway and
     the merchant has to manually reconcile it with the
     payment gateway to get the proper response.
     Also, any refunds which are in pending for more
      than 10 days are sent for manual review.
sent_to_gatewayBooleanThe flag denotes if the refund was initiated to gateway. The initial status is always false, as refunds are queued at Juspay for a maximum of 15 minutes.
refund_typeStringThe type of refund. Values can be STANDARD or INSTANT
refund_sourceStringThe name of gateway
refStringThe refund ID provided by the PG
initiated_byStringThe source of initiation
idStringThe reference ID provided by PG, if not available then its mapped to the unique request ID.
error_messageStringThe error message provided by the PG
error_codeStringThe error code provided by the PG
amountIntegerThe refund amount passed in the request
The timestamp when refund was created
If an error occurred, the response will indicate the type of failure:
Refund API failure with response code:       (click to view)
ReasonResponseResponse Code
Duplicate unique_request_id{wwwwwwwwwwwwwwwwwwwwwtww
"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"
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"
Refund amount greater than refundable{
"status_id": -1,
"status": "ERROR",
"error_message": "Refund amount
      exceeds the refundable amount.",
Amount/unique_request_id not passed{
"status": "Bad Request",
"error_message": "Mandatory fields
     are missing",
"error_code": "Mandatory fields are
Refund Amount is 0{
"status_id": -1,
"status": "ERROR",
"error_message": "Amount is invalid.",
"error_code": "invalid amount"
Invalid Order id{
"status_id": 40,
"status": "NOT_FOUND",
Unsuccessful order{
"status_id": -1,
"status": "ERROR",
"error_message": "Cannot process
     unsuccessful order.",
Invalid Authentication{
"status": "error",
"error_code": "access_denied"
The request must include  order_id and other parameters, as listed below:
Click Try It! to start a request and see the response here!