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. Here is an example of how an error code appears when an API does not fire.Sample Error Response
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.Error Description | Next Steps
The requested URL was not found on the server. | Occurs when wrong URL or HTTPS method is passed. Enter the correct URL as per the respective API request. Know more about API gateway URLs. If the issue persists, contact support.
Transactions from this IP are not allowed. Contact support for help. | Occurs when the API call is sent from an IP whose server/node is not allowlisted. Always allowlist IPs.
Different request body sent for the same Idempotency Header. | Occurs when the system receives a different payout request body for an existing idempotent header. Ensure that every payout body has a unique idempotency header.
We are facing some trouble completing your request at the moment. Please try again shortly. | Occurs in exceptional cases when there is a server issue at Razorpay’s end. Retry safely using an idempotency request or contact support.
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.
HTTP Code 401: BAD_REQUEST_AUTHENTICATION_ERROR
The OAuth token used in the request was invalid or has expired- Source: business
-
Reason:
authentication_failed - Next Steps: Please check the OAuth token being used and retry again.
The 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.
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. In case of any network issue like timeouts/5xx, you can safely fire the same request again using the same idempotency key and the request body as the original timed out request within 7 calendar days. Razorpay will ensure that the request does not get processed again if it has already been processed on our end.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 5XX error is received on the request or retried request:- Check the status of payout using
reference_id(the samereference_idyou passed as part of the request) after 5 minutes using Fetch all payouts API up to 1 hour from payout creation time, in case you do not receive webhook within 5 minutes. - If you do not receive any status for the payouts using Fetch Payout API for the reference ID provided after 1 hour, then
failthe payout after 1 hour.
Handy Tips
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.