Available in🇮🇳 India
RazorpayX aims to make all transactions successful for its customers. Even then, errors might still occur in the financial ecosystem due to intermittent communication and technical issues at multiple levels.
In RazorpayX, you can identify error codes at the source of the response, along with the reason for such errors. This will help in minimising the errors reducing the losses.
- API Error Codes: These are returned to you when the API does not fire as expected.
- Contact Error Codes: These are returned when an error occurs during contact creation.
- Fund Account Error Codes: These are returned when Fund Account creation fails.
- Payout Status Details: These provide the reason for a payouts’ state and the next steps to be taken. These are returned in the API response and webhook payloads and are available on the Dashboard.
Advantages of Error Codes
Error codes can help you build your own logic and take further remedial action at your end, wherever possible. Deriving these insights can help your business to:
- Map and analyse top failure reasons.
- Identify the source of failure.
- Narrow down and understand the cause of the failure (could be due to actions taken by your contact or external factors such as the beneficiary bank or network connectivity).
- Identify the exact reason of the failure.
- Handle actionable error codes.
- Avoid possible integration errors.
API Error Codes
API error codes are sent to you when an API cannot be fired. All successful Razorpay API responses return with HTTP Status code 200. Razorpay Errors API identifies two types of errors:- Business: Errors where merchant action is required.
- Internal: Technical errors at Razorpay’s server.
Sample Code for API Errors
API errors appear in the format shown below. You can refer to the API errors troubleshooting steps to resolve them.Sample Error Code
Here is an example of how an error code appears when an API does not fire.
Parameters
code
: string Type of the error. For example, BAD_REQUEST_ERROR.description
: string A description for the error. For example, The id provided does not exist.source
: string Possible values:business: Merchant action required.internal: Technical error at Razorpay’s server.
reason
: string The error reason. For example, input_validation_failed.step
: NA Not applicable for API Error Codes, value displayed to maintain consistency of error object.metadata
: Null value Not applicable for API Error Codes, value displayed to maintain consistency of error object.API Error Reasons and Next Steps
The below tables lists the API error reasons and the steps to fix them.HTTP Errors
Given below is a list of HTTP error codes, reasons and next steps to fix them.HTTP Code 400: BAD_REQUEST_ERROR
- Error Description: Payout is not in pending state and cannot be approved or rejected.
- Source: business
- Reason:
payout_approval_not_allowed - Next Steps: Payout approval is no longer required. No further action required.
Sample Error Response
HTTP Code 401: BAD_REQUEST_AUTHENTICATION_ERROR
The OAuth token used in the request was invalid or has expiredThe OAuth token used does not have sufficient permissions for this request
- Source: business
- Reason:
authentication_failed - Next Steps: Please check the OAuth token being used and retry again.
Sample Error Response
- Source: business
- Reason:
authentication_failed - Next Steps: Please check the OAuth token being used and retry again.
Sample Error Response
HTTP Code 500: SERVER_ERROR
- Error Description: We are facing some trouble completing your request at the moment. Please try again shortly.
- Source: internal
- Reason:
server_error - Next Steps: Retry the request using the same idempotency key and request body. See Handling 5XX Errors for the recommended retry schedule.
Sample Error Response
HTTP Code 502: GATEWAY_ERROR
- Error Description: The request could not be completed due to an error at the payment gateway or downstream bank.
- Source: internal
- Reason:
gateway_error - Next Steps: Retry the request using the same idempotency key and request body. See Handling 5XX Errors for the recommended retry schedule.
Sample Error Response
HTTP Code 503: SERVICE_UNAVAILABLE
- Error Description: The service is temporarily unavailable. This is usually a transient condition.
- Source: internal
- Reason:
service_unavailable - Next Steps: Retry the request using the same idempotency key and request body. See Handling 5XX Errors for the recommended retry schedule.
Sample Error Response
Handling 5XX Errors
5xx errors occur when servers fail to connect, causing network issues during an ongoing payout process. The idempotency feature is specifically built to handle such network issues. Recommended retry schedule If you receive a 5XX error or a timeout, retry up to 3 times at the following intervals:- After 1 minute
- After 2 minutes
- After 5 minutes
Reducing 5XX Errors
If the payout was created in the first request to the RazorpayX system using the same idempotency key, you get the created payout details along with the current status in the response to the new request.Mark Failed Status of a Payout request with 5XX error
If a 5XX error is received on the request or a retried request:- After 5 minutes, check the payout status using
reference_id(the same value you passed in the original request) via the Fetch all payouts API. Do this for up to 1 hour from payout creation time, in case you do not receive a webhook. - If no status is returned after 1 hour, mark the payout as failed.
Webhooks
We recommend you to enable webhooks so that you are alerted of the status updates in any process. By enabling alerts for errors, you can reduce the delay in troubleshooting.- You can Set Up Payout Webhooks to configure and receive instant notifications.
- They are sent whenever a specific event occurs.
- When the configured events are triggered, we send an HTTP POST payload in JSON to the webhook’s configured URL.