post https://api.juspay.in/orders//refunds
Create a refund for payment.
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 |
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 |
created | The timestamp of refund creation |
amount | The refund amount passed in the request |
Refund API failure with response code
Condition | 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 |
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”: “TEST1r32766” } | 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 |