Available in🇮🇳 India
You can create an authorisation transaction using the Razorpay APIs or Registration Link.
1.1. Using Razorpay APIs
To create an authorisation transaction using the Razorpay APIs, you need to:- Fetch Payment Methods.
- Create a Customer.
- Create an Order.
- Create Authorisation Payment using Razorpay APIs.
1.1.1. Fetch Payment Methods
Use the below endpoint to fetch a list of banks Razorpay supports for different payment methods.GET /methods
1.1.2. Create a Customer
Razorpay links recurring tokens to customers using a unique identifier generated through the Customer API. You can create customers with basic information such asemail and contact and use them for various Razorpay offerings. The following endpoint creates a customer.
Handy TipsCreate one customer ID per customer, using a unique email or phone number. Reusing or duplicating customers breaks data analysis and stops the Fetch Tokens by Customer ID API from returning the expected tokens.
POST /customers
Sample Code
Sample Code
Request Parameters
The request throws an exception by default if a customer with the exact details already exists. You can pass an additional parameter
fail_existing to get the existing customer’s details in the response. Possible values:1(default): If a customer with the same details already exists, throws an error.0: If a customer with the same details already exists, fetches details of the existing customer.
Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example,
"note_key": "Beam me up Scotty”.1.1.3. Create an Order
Use the Orders API to create a unique Razorpayorder_id that is associated with the authorisation transaction. The following endpoint creates an order.
POST /orders
- Emandate via Aadhaar
- Emandate via Netbanking
- Emandate via Debit Card
Given below is the sample code to authenticate emandate with Aadhaar. Aadhaar authentication type is enabled by default for your Razorpay account.
Authorisation transaction + auto-charge first paymentYou can register a customer’s mandate and charge them the first recurring payment as part of the same transaction. Know more about charge first payment automatically after Emandate registration.
Request Parameters
Determines whether the payment status should be changed to
captured automatically or not. Possible values:true: Payments are captured automatically.false: Payments are not captured automatically. You can manually capture payments using the Manually Capture Payments API.
The unique identifier of the customer to be charged. For example,
cust_D0cs04OIpPPU1F.A user-entered unique identifier of the order. For example,
rcptid #1. You should map this parameter to the order_id sent by Razorpay.Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example,
"note_key": "Beam me up Scotty”.Emandate type used to make the authorisation payment. Possible values:
netbankingdebitcardaadhaar
The maximum amount in paise a customer can be charged in a transaction. Know about the maximum and default values.
The Unix timestamp to indicate till when you can use the token (authorisation on the payment method) to charge the customer subsequent payments. Defaults to 40 years. The maximum value you can set is 40 years from the current date. Any value beyond this will throw an error.
Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example,
"note_key": "Beam me up Scotty”.Mandatory if the
bank_account object is sent. Name of the beneficiary. For example, Gaurav Kumar. Must be 4 to 120 characters.1.1.4. Create an Authorisation Payment
Once an order is created, your next step is to create a payment. Use the below endpoint to create a payment with payment methodemandate.
POST /payments/create/json
Request Parameters
The unique identifier of the order created in Step 1.1.3.
The unique identifier of the customer to be charged. For example,
cust_K39wXdBlhqNk0B.Mandatory if not sent in Create an Order (step 1.1.3). Emandate type used to make the authorisation payment. Possible values:
netbankingdebitcardaadhaar
The customer’s bank name. The bank code used here should match the bank details used in Step 1.1.3. Use the Method API to check the bank code.
Customer’s bank account details. Optional if they were sent in Create an Order; otherwise mandatory.
Mandatory if the
bank_account object is sent. Name of the account holder. For example, Gaurav Kumar.Response Parameters
If the payment request is valid, the response contains the following fields. Refer to the S2S Json V2 integration document for more details.A list of action objects available to you to continue the payment process. Present when the payment requires further processing.
An indication of the next step available to you to continue the payment process. The value here is
redirect - Use this URL to redirect customer to the bank page.1.2. Using a Registration Link
Registration Links are an alternate way of creating an authorisation transaction. If you create a registration link, you need not create a customer or an order. When you create a registration link, an invoice is automatically issued to the customer. The customer can use the invoice to make the Authorisation Payment. Know how to create Registration Links using the Dashboard.Handy TipsYou can use webhooks to get notifications about successful payments against a registration link. Know more about Webhooks.
0.
1.2.1. Create a Registration Link
The following endpoint creates a registration link.POST /subscription_registration/auth_links
- Emandate via Aadhaar
- Emandate via Netbanking
- Emandate via Debit Card
Request Parameters
The maximum amount, in paise, a customer can be charged in a transaction. Know about maximum and default values.
The Unix timestamp indicates till when you can use the token (authorization on the payment method) to charge the customer their subsequent payments. Defaults to
40 years. The maximum value you can set is 40 years from the current date. Any value beyond this will throw an error.Mandatory if the
bank_account object is sent. Name of the beneficiary. For example Gaurav Kumar. Must be 4 to 120 characters.Mandatory if the
bank_account object is sent. Customer’s bank account number. For example 11214311215411.Indicates if SMS notifications are to be sent by Razorpay. Possible values:
true(default): Notifications are sent by Razorpay .false: Notifications are not sent by Razorpay.
Indicates if email notifications are to be sent by Razorpay. Possible values:
true(default): Notifications are sent by Razorpay .false: Notifications are not sent by Razorpay.
A unique identifier entered by you for the order. For example,
Receipt No. 1. You should map this parameter to the order_id sent by Razorpay.This is a key-value pair that is used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example,
"note_key": "Beam me up Scotty”.1.2.2. Send/Resend Notifications
The following endpoint sends/resends notifications with the short URL to the customer:POST /invoices/:id/notify_by/:medium
Sample Code
Sample Code
Response
Path Parameters
The unique identifier of the invoice linked to the registration link for which you want to send the notification. For example,
inv_1Aa00000000001.Determines through which medium you want to resend the notification. Possible values:
smsemail
1.2.3. Cancel a Registration Link
The following endpoint cancels a registration link.POST /invoices/:id/cancel
Handy TipsYou can only cancel registration link in the
issued state.Sample Code
Sample Code
Response
Path Parameter
The unique identifier for the invoice linked to the registration link that you want to cancel. For example,
inv_1Aa00000000001.1.3. Error Scenarios
If the authorisation payment fails, the payment carries an error object withcode, description, source, step and reason. Use the reason to decide the next action for the customer. For the Emandate error reasons, see Error Codes.