Razorpay lets you collect payments in Indian rupees (INR) from customers in India. With SubscriptionFlow you can take the first payment through the Razorpay checkout window and save a card mandate or a UPI Autopay mandate at the same time, so renewals are debited automatically.
Razorpay works in INR only. Your Razorpay account must have Recurring Payments (cards and UPI Autopay) turned on: ask Razorpay Support to enable it. Mandates through netbanking or Aadhaar (eMandate) are not offered.
Before you start
In your Razorpay Dashboard, collect:
- Key ID and Key Secret: from Account & Settings › API Keys. Test keys start with
rzp_test_, live keys withrzp_live_. - Webhook Secret: a secret you choose when you create the webhook under Account & Settings › Webhooks. Test mode and live mode have separate webhooks.
Connect Razorpay
- Click the ⚙️ icon at the top right to open Settings, then open Payment Gateways.
- Open the Available Gateways tab and click Razorpay.
- On the Connection tab of Configure Razorpay, fill in:
- Label (optional): a name to tell this account apart from others.
- Key ID: your Razorpay Key ID. It is sent to the customer's browser to open the checkout window.
- Key Secret: the secret created with the Key ID.
- Webhook Secret (optional, but recommended): the secret you set on your Razorpay webhook.
- Card mandate maximum amount (paise): the most that can be debited from a saved card in one payment, in paise (100 paise = ₹1). Default 1500000 (₹15,000), which is also the highest value allowed without extra customer authentication. Values are kept between 100 and 1500000.
- UPI mandate maximum amount (paise): the most that can be debited through UPI Autopay in one payment. Leave it empty to use twice the first payment, with a minimum of ₹5,000 and a maximum of ₹15,000.
- Sandbox: turn on when you use test keys.
- Click Test Connection to check the keys, then click Save. On the Advanced Options tab, choose who can use the gateway and whether to make it the default, the same as for other gateways.
- After saving, copy the Webhook URL shown on the gateway page and add it to your Razorpay webhook. Enable these events:
payment.captured,payment.failed,order.paid,token.confirmed,token.rejected,token.paused,token.cancelled,refund.processed,order.notification.failed.
The mandate maximum is fixed when the customer approves the mandate. If a later invoice is larger than the mandate's maximum, the renewal payment is refused with "Invoice amount … exceeds the mandate limit" and the customer must save a new payment method. Set the maximum high enough for your largest expected invoice, including upgrades and taxes.
What the customer sees at checkout
On checkouts and payment pages that use Razorpay, the customer:
- Chooses Card or UPI.
- Leaves Save for automatic renewals ticked to create a mandate. For trials and zero-amount checkouts the box is ticked and locked, because a mandate is needed for later renewals.
- Completes the payment in the Razorpay window. For trials and zero-amount checkouts, Razorpay takes a ₹1 verification payment, which is refunded straight away.
The payment is checked with Razorpay before the invoice is marked Paid. The saved mandate appears as the customer's payment method.
How renewals are charged
- On renewal, SubscriptionFlow asks Razorpay to debit the saved card or UPI mandate.
- The bank sends the customer a pre-debit notification and debits the account later: about 36 hours for cards and 25 hours for UPI. Until then the transaction stays Pending.
- Razorpay's webhook then marks the transaction Paid or Failed. If a webhook is missed, a status sync settles Pending payments (see below).
- A mandate must be confirmed before it can be charged. If the mandate is still unconfirmed, paused, rejected or cancelled, the payment fails and the customer needs to update their payment method.
- While one Razorpay debit for an invoice is Pending, a second debit for the same invoice is not started.
Keep payment statuses in sync
As a safety net for missed webhooks, add a schedule for SyncRazorpayPaymentStatuses in Settings › Schedules. It isn't added for you. It settles Pending Razorpay debits and activates mandates still waiting for confirmation. Running it every 2 hours is recommended.
Refunds
You can refund Razorpay payments, in full or in part, from the transaction in SubscriptionFlow. The refund is sent to Razorpay and shown on the transaction.
Common errors
| Message | What it means |
|---|---|
| Amount exceeds the mandate limit allowed by the UPI app | The UPI app's own limit is lower than the debit. |
| Invoice amount … exceeds the mandate limit | The invoice is larger than the mandate maximum. The customer must save a new mandate. |
| Mandate is not confirmed yet | Razorpay or the bank has not confirmed the mandate yet. |
| Pre-debit notification was not sent to the customer | The bank could not notify the customer before the debit; the debit was not made. |
| Debit frequency limit exceeded for this mandate | Too many debits on the mandate in the period. |
| Insufficient funds / Card declined by the issuing bank | Normal decline; payment retries and dunning apply. |
Related articles
- How to connect with a payment gateway
- Overview: Payment Methods
- Automate Payment Retries & Dunning
Comments
0 comments
Please sign in to leave a comment.