post https://api.juspay.in/orders//refunds
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:
If an error occurred, the response will indicate the type of failure:
Refunds block (contained in Order Object) (click to view)
Parameter | Type | Description |
---|---|---|
Refunds: [{...},{...},..] wwwwwwwwwwnwww | Array of Objects | 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)
refunds
array: (click to open)Field | Type | Description |
---|---|---|
unique_request_id | String | The unique request ID that is passed during refund initiation. Do not pass any special characters. |
status | String | The status of the refund initiated. Initial status will always be PENDING Status codes and meaningSUCCESS This means that the refund has been successfully executed. PENDING This would mean that the refund has been queued withJusPay or with the downstream system. FAILURE We were unable to process the refund successfully. You have to try again with a new unique_request_id .MANUAL_REVIEW 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_gateway | Boolean | The 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_type | String | The type of refund. Values can be STANDARD or INSTANT |
refund_source | String | The name of gateway |
ref | String | The refund ID provided by the PG |
initiated_by | String | The source of initiation |
id | String | The reference ID provided by PG, if not available then its mapped to the unique request ID. |
error_message | String | The error message provided by the PG |
error_code | String | The error code provided by the PG |
amount | Integer | The refund amount passed in the request |
created | Time- stamp | The timestamp when refund was created |
Refund API failure with response code: (click to view)
Reason | Response | Response 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" } | 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 |
⭣
The request must include order_id and other parameters, as listed below: