Available in🇮🇳 India
Before you start, see How Cards Recurring Works and AFA Limits and test your integration.
You can create an authorisation transaction using the Razorpay APIs or Registration Link.
Handy TipsBank downtime can affect success rates when processing recurring payments via debit cards.
1.1. Using Razorpay APIs
To create an authorisation transaction using the Razorpay APIs, you need to:1.1.1. Create a Customer
Token Sharing for Partner Auth ModelIf you are a Razorpay Partner, who wants to use this API via Partner Auth, you must ensure the following:
- Add the basic auth with partner credentials (client_id and client_secret).
- Add the
account_idof the sub-merchant usingX-Razorpay-Accountin the header. For example, -H “X-Razorpay-Account: acc_KBrJAIEqre5ucn”
Request
email 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
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.
Response Parameters
Response Parameters
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.2. 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
Token Sharing for Partner Auth ModelIf you are a Razorpay Partner, who wants to use this API via Partner Auth, you must ensure the following:
- Add the basic auth with partner credentials (client_id and client_secret).
- Add the
account_idof the sub-merchant usingX-Razorpay-Accountin the header. For example, -H “X-Razorpay-Account: acc_KBrJAIEqre5ucn”
Request
Request Parameters
Request Parameters
The maximum amount that can be auto-debited in a single charge. The minimum value is . Debits above the India AFA limit (₹15,000, or ₹1,00,000 for eligible business categories) need the customer’s Additional Factor of Authentication (AFA) as per RBI guidelines.
100, that is, The Unix timestamp that indicates when the authorisation transaction must expire. The card’s expiry year is considered a default value.
The frequency at which you can charge your customer. Possible values:
weeklymonthlyyearlyas_presented
A user-entered unique identifier for the order. For example,
Receipt No. 1. You should map this parameter to the order_id sent by Razorpay.Response Parameters
Response Parameters
A user-entered unique identifier of the order. For example,
Receipt No. 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”.order_id after you create an order.1.1.3. 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 methodcard.
Check if the Card Supports Recurring PaymentsBefore you create the authorisation payment, you can use the IIN API to check whether the customer’s card supports recurring payments. This is an on-demand feature; raise a request with our Support team to get it activated on your account.
GET /iins/:iin. Pass the first 6 digits of the customer’s card number as iin. For example, 438628.Response
recurring.available: true: the card supports recurring payments. Create the authorisation payment.recurring.available: false: the card does not support recurring payments. Do not attempt the authorisation payment; ask the customer to use another card or another payment method.
Token Sharing for Partner Auth ModelIf you are a Razorpay Partner, who wants to use this API via Partner Auth, you must ensure the following:
- Add the basic auth with partner credentials (client_id and client_secret).
- Add the
account_idof the sub-merchant usingX-Razorpay-Accountin the header. For example, -H “X-Razorpay-Account: acc_KBrJAIEqre5ucn”
Request
POST /payments/create/json
Handy Tips
- To process recurring transactions, customer card details will need to be secured/tokenised in accordance with the applicable laws. You will be solely responsible for obtaining informed consent from customers for the processing of emandates and such consent shall be explicit and not by way of a forced/default/automatic selection of check box, radio button etc.
- When the merchant is sharing
recurring: trueorpreferred, it is for tokenising the card as per applicable rules for recurring mandate creation. If such consent is not shared during the payment flow, then Razorpay will not tokenise the card or process the emandate/ recurring transaction.
Request Parameters
Request Parameters
The unique identifier of the order created in Step 1.1.2.: Create an Order.
Possible values:
true: Recurring payment is enabled.false: Recurring payment is not enabled.
Handy TipsThe
recurring parameter also supports the value preferred. Use this when you want to support recurring payments and one-time payment in the same flow.Saves the customer’s card details. Possible values:
1: Saves the card details.0: Does not save the card details.
Unformatted card number. This field is required if value of
method is card. Use one of our test cards to try out the payment flow.The expiry month of the card in
MM format. For example, 01 for January and 12 for December.CVV printed on the back of the card.
Handy Tips
- CVV is not required by default for tokenised cards across all networks.
- CVV is optional for tokenised card payments. Do not pass dummy CVV values.
- To implement this change, skip passing the
cvvparameter entirely, or pass anullor empty value in the CVV field. - We recommend removing the CVV field from your checkout UI/UX for tokenised cards.
- If CVV is still collected for tokenised cards and the customer enters a CVV, pass the entered CVV value to Razorpay.
Response Parameters
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. Possible values:
otp_generate- Use this URL to allow the customer to generate OTP and complete the payment on your webpage.redirect- Use this URL to redirect the customer to submit the OTP on 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.
1.2.1. Create a Registration Link
The following endpoint creates a registration link.POST /subscription_registration/auth_links
Request Parameters
Request Parameters
The maximum amount that can be auto-debited in a single charge. The minimum value is . Debits above the India AFA limit (₹15,000, or ₹1,00,000 for eligible business categories) need the customer’s Additional Factor of Authentication (AFA) as per RBI guidelines.
100, that is, The Unix timestamp till when you can use the token (authorisation on the payment method) to charge the customer subsequent payments. The card’s expiry year is considered a default value.
The frequency at which you can charge your customer. Possible values:
weeklymonthlyyearlyas_presented
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.Response Parameters
Response Parameters
The status of the invoice. Possible values:
draftissuedpartially_paidpaidcancelledexpireddeleted
The delivery status of the SMS notification for the invoice sent to the customer. Possible values:
pendingsent
The delivery status of the email notification for the invoice sent to the customer. Possible values:
pendingsent
Indicates whether the customer can make a partial payment on the invoice. Possible values:
true: The customer can make partial payments.false(default): The customer cannot make partial payments.
Amount to be paid using the invoice. Must be in the smallest unit of the currency. For example, if the amount to be received from the customer is , pass the value as
29995.The short URL that is generated. This is the link that can be shared with the customer to receive payments.
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
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 Parameter
Response Parameter
The status of the invoice. Possible values:
draftissuedpartially_paidpaidcancelledexpireddeleted
The delivery status of the SMS notification for the invoice sent to the customer. Possible values:
pendingsent
The delivery status of the email notification for the invoice sent to the customer. Possible values:
pendingsent
Indicates whether the customer can make a partial payment on the invoice. Possible values:
true: The customer can make partial payments.false(default): The customer cannot make partial payments.
Amount to be paid using the invoice. Must be in the smallest unit of the currency. For example, if the amount to be received from the customer is , pass the value as
29995.The short URL that is generated. This is the link that can be shared with the customer to receive payments.
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 Cards Recurring error reasons, see Error Codes.