post https://api.juspay.in/orders//refunds
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
Fields | Description |
---|---|
unique_request_id | The unique request id that is passed during refund initiation. Do not pass any special characters. |
status | The status of the refund initiated. Initial status will always be PENDING |
sent_to_gateway | The 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_type | The type of refund. Values can be STANDARD, INSTANT |
refund_source | The name of gateway |
ref | The refund id provided by the PG |
initiated_by | The source of initiation. |
id | The reference id provided by PG, if not available then its mapped to unique request id. |
error_message | The error message provided by the PG |
error_code | The error code provided by the PG |
amount | The refund amount passed in the request |
created | The timestamp of refund creation |
Refund API failure with response code
Reason | Response | Response 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 5 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 |
Refund limit exceeds (25 refunds per order is the default limit) | { "status": "ERROR", "error_code": "request.exceeded", "error_message": "Refund create exceeded the limit", "status_id": -1 } | 400 |
Invalid Authentication | { "status": "error", "error_code": "access_denied" } | 401 |