Available in🇮🇳 India
You should perform the following steps to create and charge your customer subsequent payments:
3.1. Create an Order to Charge the Customer
You have to create a new order every time you want to charge your customers. This order is different from the one created during the authorisation transaction. Razorpay supports two types of flows for auto-debits: the coupled flow and the decoupled flow.- Coupled flow: You create the order and the payment together. Razorpay immediately sends the Pre-Debit Notification (PDN) to the customer, and schedules the debit and its retries.
- Decoupled flow: You create the order first and send the
notificationobject. You then create the payment after ensuring that a minimum of 24 hours has passed since the PDN was sent to the customer.
Handy TipsWe recommend choosing between the coupled and decoupled flow for your whole UPI Autopay integration on your merchant account. To maximise the collection success rate, you can use the coupled flow, as it needs the least intervention from your end.
POST /orders
Request Parameters
amount mandatory
: integer Amount in currency subunits. For cards, the minimum value is 100 (₹1).
currency mandatory
: string The 3-letter ISO currency code for the payment. Currently, we only support INR.
receipt optional
: string 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.
notes optional
: object Key-value pair you can use to store additional information about the entity. Maximum of 15 key-value pairs, 256 characters each. For example, "note_key": "Beam me up Scotty”.
notification
: object Details of the pre-debit notification. Use this object to decide between the coupled and decoupled flow. If you send this object, Razorpay does not automatically schedule the debit or its retries. If you do not pass this object, we automatically try to debit 25 hours after the pre-debit notification is delivered, and retry 3 times if the debit attempts fail.
token_id mandatory
: string The token_id generated when the customer successfully completes the authorisation payment. Different payment instruments for the same customer have different token_id.
payment_after mandatory
: integer UNIX timestamp post which the debit is supposed to happen. Mandatory for the decoupled flow.
payment_capture mandatory
: boolean 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.
3.2. Create a Recurring Payment
Once you have generated anorder_id, use it with the token_id to create a payment and charge the customer. The following endpoint creates a payment to charge the customer.
POST /payments/create/recurring
Request Parameters
email mandatory
: string The customer’s email address. For example, gaurav.kumar@example.com.
contact mandatory
: integer The customer’s phone number. For example, 9876543210.
currency mandatory
: string 3-letter ISO currency code for the payment. Currently, only INR is allowed.
amount mandatory
: integer The amount you want to charge your customer. This should be the same as the order amount.
order_idmandatory
: string The unique identifier of the order created. For example, order_1Aa00000000002.
customer_id mandatory
: string The unique identifier of the customer you want to charge. For example, cust_1Aa00000000002.
token mandatory
: string The token_id generated when the customer successfully completes the authorisation payment. Different payment instruments for the same customer have different token_id.
recurring mandatory
: boolean Determines whether recurring payment is enabled or not.
true: Recurring payment is enabled.false: Recurring payment is not enabled.
descriptionoptional
: string A user-entered description for the payment. For example, Creating recurring payment for Gaurav Kumar
notesoptional
: object Key-value pair you can use to store additional information about the entity. Maximum of 15 key-value pairs, 256 characters each. For example, "note_key": "Beam me up Scotty”.
3.3. Best Practices
Best Practices
- For Recurring Payments, it may take between 24-36 hours for the subsequent payment to reflect on your Dashboard.
- This is because of the failure of pre-debit notification and/or any retries that we attempt for the payment.
- Do not create another subsequent payment until you get the status of the previous one.
- NPCI allows only one successful debit on a token per billing cycle. For example, if the billing frequency is monthly, you can execute only one successful debit per month on that token.
- The subsequent payment may fail if there is late authorisation of an earlier payment.
- For mandates with fixed frequency, do not create orders on the last day of the billing cycle. Doing so will fail the debit.
- Always check the token status before attempting the debit. If the token is not
confirmed, do not attempt the debit. - Razorpay sends the pre-debit notification immediately when you submit the Create Order API. We recommend timing the notification as per the customer’s billing cycle.
- Sometimes the customer modifies the token after you send the pre-debit notification. In such cases, you immediately receive the corresponding status change webhook and the payment moves to the
failedstate. - For coupled flow merchants, the payment remains in the
createdstate until the debit is attempted and the payment succeeds or all retries are exhausted. Since Razorpay schedules the debits and retries, wait for the final payment status before taking a call on the subscription status of the customer. Depending on your retry configuration, this can take between T+1 and T+5 days. - If the debit amount exceeds ₹15,000 for regular industries (or ₹1,00,000 for lending and investment categories), the customer will receive a collect request on their UPI app and must enter their PIN to approve the payment. Ensure your system handles this Additional Factor of Authentication (AFA) flow gracefully.