A subscription app in India can do everything right at signup and still lose a chunk of renewals in month two: a customer revokes the mandate from their UPI app, the debit fails at a busy hour, or the backend never noticed the cancellation and keeps showing "active". UPI Autopay subscription integration is less about the checkout screen and more about the state machine that runs for months after it.
This post walks through that state machine, the rules that shape it, and the webhook handling that keeps your database honest. It applies whether the front end is Flutter, React Native or a web app. A quick note first: this covers RBI and NPCI rules as we understand them from public sources. It isn't legal or compliance advice, and your gateway's docs and your compliance advisor have the final word.
The rules that shape a UPI Autopay subscription integration
RBI consolidated its recurring payment rules in the Digital Payments: E-mandate Framework, 2026, issued on 21 April 2026. The parts that change how you build:
- Registration needs the customer's authentication (their UPI PIN for UPI Autopay). After that, debits within the mandate can run without it, up to a per-transaction limit: ₹15,000 for most categories, and ₹1 lakh for insurance premiums, mutual fund subscriptions and credit card bill payments. Above that, each debit needs the customer to authenticate.
- A pre-debit notification goes out at least 24 hours before each debit, with the merchant name, amount, date and time of debit, mandate reference and reason. The customer can opt out of that specific debit, or the whole mandate.
- Customers can modify or withdraw a mandate at any time, with authentication. They don't need to ask you. They can do it from their UPI app.
- No charging customers for using e-mandates.
NPCI adds operational rules on top. Since 1 August 2025, Autopay debits are executed outside peak hours (peak being roughly 10 AM to 1 PM and 5 PM to 9:30 PM), with one attempt plus up to three retries. Razorpay's docs also note that NPCI allows only one successful debit per mandate per billing cycle, so you can't top up a missed charge with a second debit in the same month.
In practice your gateway handles most of this. With Razorpay's UPI recurring payments, for example, the pre-debit notification goes out and the debit is attempted about 25 hours later, by default. What you own is reacting correctly to everything that can happen around it.
Model the mandate and the subscription separately
The most common design mistake we see is a single is_subscribed boolean. You need at least two things tracked separately:
- The mandate (Razorpay calls it a token): created, confirmed, rejected, paused, cancelled. This is the customer's permission to debit.
- Your subscription: trialing, active, past due, cancelled, expired. This is what the customer gets access to.
They move independently. A mandate can be cancelled from a UPI app while the subscription still has two weeks of paid access left. A debit can fail while the mandate stays valid and retries continue. Collapsing these into one field is how you end up cutting off a paying customer, or giving a cancelled one free access.
Store, per mandate: the gateway's mandate or token ID, the maximum amount, frequency, start and end dates, current status and the time of the last status change. Per billing cycle, store an invoice or charge record with its own status. That record is what you reconcile against settlement reports later.
Webhooks: the events that matter
The app will be closed for almost the whole life of a subscription, so webhooks are the only way you'll hear about anything. On Razorpay, depending on whether you use the Subscriptions product or the lower-level recurring payments API, the relevant events include:
subscription.authenticated,subscription.activatedandsubscription.chargedfor the happy path;subscription.pendingwhen a charge fails and retries are under way, andsubscription.haltedonce retries are exhausted;subscription.cancelled,subscription.pausedandsubscription.resumed;- for the recurring payments API:
token.confirmed,token.rejected,token.pausedandtoken.cancelled, pluspayment.capturedandpayment.failed.
Handle them with three rules:
- Verify the signature (Razorpay sends
X-Razorpay-Signature, an HMAC-SHA256 of the raw body with your webhook secret) before reading the payload. - Process each event once. Duplicates are expected. Razorpay sends
x-razorpay-event-id, unique per event; record it and skip any you've seen. - Don't assume order. A
chargedevent can arrive after apendingone for a later cycle. Compare timestamps, or fetch the current state from the API, before moving your subscription backwards.
Respond with a 2xx quickly (Razorpay expects it within 5 seconds) and do slow work, like sending emails or generating invoices, from a queue.
Designing for failure
Failures aren't edge cases in recurring billing. Plan the product behaviour for each:
- Debit fails, retries pending: keep access, mark the subscription past due, show a gentle banner. Most of these resolve on retry.
- Retries exhausted: end access at the end of the paid period, and offer a one-tap path to a fresh mandate. A new mandate means a new authentication, so make it short.
- Mandate cancelled or paused from the UPI app: keep access until the paid period ends, stop expecting renewals, and ask (once, politely) whether they meant to cancel.
- Customer opts out of one debit after the pre-debit notification: treat it as a skipped cycle, not fraud.
- Price change above the mandate's maximum amount: plan for a new mandate. Set the maximum with headroom at signup if your plans might change.
Add a nightly job that compares your mandate and subscription states with the gateway's API. Webhooks get disabled after repeated failures (Razorpay retries for 24 hours, then disables the endpoint), and a reconciliation job is how you find out before your customers do.
We've built EMI plans, refunds and post-payment reconciliation for a production ed-tech payment portal. If you're adding UPI Autopay to a web or mobile product, orithLabs can design the backend and webhook handling as part of our web development work, and the first call is free. And once more: this is engineering guidance, not legal or compliance advice. Check the current RBI and NPCI circulars and your gateway's terms.