Available in🇮🇳 India
1.1 Fetch the Payment Methods
CallGET …/payment_methods to get one item per payment method, with its instruments inside. Add method to fetch one payment method:
To refresh one instrument later, fetch its payment method. You cannot fetch a single instrument.
Curl
instruments. This response shows all 6 payment methods, with a few instruments each:
Response
method, such as ?method=cod. The response has the same shape, with one item.
Instrument Object
Handy Tips
- Never hard-code the list of instruments. Fetch it, because Razorpay may add payment methods, instruments, statuses and reason codes. Ignore what you do not know.
- The list is not paginated. An empty
itemsarray means Razorpay could not load the account. Retry. - Texts meant for people, such as
name,status_reason.description,requirements[].descriptionandrequirements[].reason, follow theAccept-Languageheader. Codes are never translated. - Allow a timeout of at least 5 seconds. A fetch typically takes 1 to 2 seconds.
- Instruments can change without any call from you, as banks, providers and Razorpay move onboarding along.
1.2 Instrument Ids
Every instrument has one id, unique across all payment methods. The same bank code can sit in several methods (hdfc is in netbanking and in both EMI groups), so the id always starts with the payment method. Read it from the fetch response and send it unchanged as instrument.
Do not use
name as an id. It follows Accept-Language and can be reworded.
1.3 Enable an Instrument
CallPATCH …/payment_methods with the instrument and "enabled": true. Send a new X-Idempotency-Key for each intended change.
Curl
Response
requirements is included only when the status is in_progress or needs_clarification, so you can answer it at once. Read the status:
If the instrument first needs onboarding and Razorpay needs something, the status is
in_progress and the response lists the requirements. For example, Kotak Mahindra Bank netbanking:
Curl
Response
1.4 Disable and Re-enable
Send"enabled": false to switch an instrument off, or "enabled": true to switch it back on. Disabling an instrument that is still being onboarded stops the onboarding and returns it to eligible.
An activated instrument switches back on at once, with no new onboarding. There is no switch for a whole payment method. To turn a method off, switch off each of its instruments.
1.5 Handle Errors
Handle errors by HTTP status, then byerror.reason. Never build logic on error.description, which can change. The ones you are most likely to meet when enabling:
After a timeout, a
409 idempotency_in_progress or a 5xx, send the same request again with the same X-Idempotency-Key. After a 429, wait for the Retry-After header.