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
Response
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
nameandstatus_reason.description, follow theAccept-Languageheader. Codes are never translated.
1.2 Name an Instrument
An instrument has no id of its own. To enable or disable it, name it in the request body by its place in the payment method’s object: the list and the value a payment carries, or its own key.1.3 Enable an Instrument
CallPATCH …/payment_methods with the method, the instrument and "enabled": true. Send a new X-Idempotency-Key for each intended change.
Curl
Response
status:
Enabling an instrument that is already on, or already being onboarded, changes nothing and returns it as it is.
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.
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. The ones you are most likely to meet when enabling:
After a timeout or a
5xx, send the same request again with the same X-Idempotency-Key. After a 429, wait for the Retry-After header.