Follow One Subscription From Free Trial to Settlement
The problem
A "Start 7-day free trial" button looks like the simplest thing on the internet. One tap, no money, done.
Behind it sits a small city: a plan, a subscription object, a mandate registered with a bank under RBI rules, a ₹5 charge that refunds itself, a token instead of your card number, a notice that must reach your phone a day before money moves, an invoice, a webhook that has to prove it is real, a retry schedule for when your balance is low, and a transfer to the merchant's bank two working days later, minus fees.
Most glossaries list these words alphabetically and teach you nothing. This one follows a single subscription from the tap to the money landing, and each term appears at the moment it does its job. Land here from a link in another part and the heading you need is waiting, with the story around it.
The reader and the website are made up. The machinery is real, and every rule, number, state name and API field is sourced at the bottom. If you have used BlogLLM Pro, you have walked this exact path: it is ₹499 a month on Razorpay with a 7-day free trial.
This is Part 1 of the series:
- This glossary story
- How UPI AutoPay and card mandates charge you every month
- The subscription state machine, from created to halted
- How payment webhooks prove they are real
- What happens when a renewal payment fails
- Invoices, upgrades, add-ons and coupons in subscription billing
- How an open source billing engine works inside
- Build your own Razorpay Subscriptions clone
Here is the whole trip on one screen. Do not memorise it. By the end of the page every arrow will make sense.
sequenceDiagram participant A as Aisha (phone) participant S as StudyNook server participant R as Razorpay participant B as Aisha's bank or UPI app S->>R: create plan (once) and subscription R-->>S: sub_... with short_url A->>R: Checkout: start 7-day trial R->>B: ₹5 authorisation, needs UPI PIN or OTP B-->>R: approved, mandate registered R-->>A: ₹5 refunded R->>S: webhook: subscription.authenticated Note over A,B: seven days of free use B->>A: pre-debit notification, 24h or more ahead R->>B: charge ₹499 using the token B-->>R: success R->>S: webhooks: subscription.activated, subscription.charged, invoice.paid R->>S: settlement to bank, T+2 working days, minus fees
Act one: before Aisha shows up
Aisha is a second year engineering student in Pune. Tonight she will find StudyNook, a made-up site that sells practice problems for ₹499 a month. Some pieces of her subscription exist before she visits.
Plan
The plan is the price tag, written down once. On Razorpay you create it with POST /v1/plans. It says how much, and how often.
StudyNook's plan has period set to monthly and interval set to 1, which means every one month. An interval of 2 with monthly would mean every two months. Daily plans need an interval of at least 7, so you cannot bill someone every single day.
The amount lives in item.amount, in paise, so ₹499 is 49900. The minimum is 100 paise, ₹1. One plan serves every subscriber on it.
Customer
A customer is the person who pays, stored as a record with an ID like cust_.... The subscription carries a customer_id, and Razorpay's recurring APIs use it together with a token to charge her later.
Act two: the tap
Aisha reads two sample problems, likes them, and taps "Start 7-day free trial".
Subscription
StudyNook's server now creates a subscription: the link between one plan and one customer over time. The call is POST /v1/subscriptions, and plan_id is required.
It also needs to know when to stop. You pass either total_count, the number of billing cycles, or end_at, a date, never both. Razorpay supports up to 100 years, so "forever" is a large total_count. (One error message in its integration guide says 10 years. Razorpay's docs disagree with themselves now and then, and this series points it out each time.)
The response is a subscription with an ID like sub_..., a status of created, counters like paid_count and remaining_count, and a short_url: a hosted link where the customer can authorise it.
Free trial
Razorpay has no field called "trial". A free trial is simply a subscription whose start date is in the future.
The field is start_at. Leave it out, and the subscription starts right after the authorisation payment, so Aisha would pay ₹499 tonight. Set it seven days from now, and the first real charge waits for day 7. It cannot be in the past.
Checkout
StudyNook opens Checkout, Razorpay's payment screen, with the subscription ID. Aisha picks how she will pay. On Subscriptions, Razorpay lists credit and debit cards, UPI (in early access) and Emandate (in limited access).
When it finishes, Checkout hands StudyNook three values: razorpay_payment_id, razorpay_subscription_id and razorpay_signature. Hold on to that signature. It comes back later.
Act three: asking the bank for permission
Here is the heart of it. StudyNook cannot just remember Aisha's card and charge it every month. She has to set up a standing permission first, and prove it is really her.
Mandate
A mandate, or e-mandate, is that standing permission: "this merchant may debit me on this schedule, up to this amount". RBI's current rule, the E-mandate Framework of April 21, 2026, covers cards, prepaid instruments and UPI. A mandate is registered once, states how long it is valid, and can be fixed or variable, with the customer setting the maximum. The customer can change or withdraw it at any point of time.
AFA
The proof is AFA, additional factor of authentication: an OTP or 3D Secure for cards, a UPI PIN for UPI, NetBanking for Emandate.
RBI requires AFA to register, change or withdraw a mandate, and for the first transaction. After that, recurring debits up to ₹15,000 per transaction run without it (₹1,00,000 for insurance, mutual funds and credit card bills). Aisha's ₹499 is far below, so after tonight she will not be asked again. Part 2 tells the story of how that limit climbed from ₹2,000.
Authorisation transaction
RBI lets the first transaction be combined with registration. Razorpay uses that: the mandate is set up by a real payment, called the authorisation transaction.
How much it is depends on the start date. Razorpay's workflow docs list four cases:
| Start | Upfront amount? | What the customer pays to authorise |
|---|---|---|
| Immediate | No | The plan amount |
| Future (a trial) | No | ₹5, refunded automatically |
| Immediate | Yes | Upfront amount plus plan amount |
| Future | Yes | Upfront amount only |
Aisha is in row two. She approves ₹5, the mandate gets registered, and the ₹5 goes back. If you have ever seen a ₹5 debit right after starting a "free" trial, this is it.
The subscription moves from created to authenticated, and StudyNook receives a subscription.authenticated webhook. (In test mode, Razorpay says a future start subscription goes to authenticated with no webhook at all.)
UPI AutoPay
If Aisha picks UPI, the mandate is a UPI AutoPay mandate. NPCI, which runs UPI, describes AutoPay as a way to set up an e-mandate from any UPI app for recurring payments like phone bills, EMIs and OTT subscriptions.
She approves it with her UPI PIN, and from then on it shows up in her UPI app. NPCI says customers can modify, revoke, pause and unpause mandates from there. That last part has teeth: Razorpay's FAQ says that if a customer pauses a UPI subscription from their app, the merchant cannot resume it.
Card mandate
If she types a card instead, it is a card mandate, approved with an OTP or 3D Secure. Not every card can do this: Razorpay shows a Card does not support recurring payments error for cards from banks that are not live on recurring, and its list of supported debit card banks has just four names.
Emandate and eNACH
The third road is a bank account debit. Razorpay calls it Emandate: a standing instruction to your bank to debit your account, usually authorised with NetBanking. Razorpay's pricing blog also lists NACH (paper and e-NACH) as a supported recurring method, priced on request. Emandate is the slow road: registration and payment cannot happen on the same day, the customer cancels through their bank, and a mandate cannot be edited once created.
Token
Whatever Aisha picked, StudyNook never stores her card number or bank details. What it gets is a token: a stand-in that only works for this merchant.
For cards, RBI's 2021 tokenisation circular makes the token unique to each card, token requestor and merchant, and lets only card issuers and networks store real card data. Everyone else keeps at most the last four digits and the issuer's name. Razorpay generates a token_id when the authorisation completes.
If StudyNook's database leaked tomorrow, there would be no card numbers in it. That is the point.
flowchart LR T[Aisha taps Start trial] ==> C{How does she pay?} C ==>|UPI| U[UPI AutoPay mandate, approved with UPI PIN] C ==>|Card| K[Card mandate, approved with OTP or 3D Secure] C ==>|Bank account| E[Emandate, approved with NetBanking] U ==> A[₹5 authorisation, refunded] K ==> A E ==> A A ==> TK[Token stored by Razorpay, not the card or account] TK ==> S[Subscription status: authenticated]
Act four: day 7
A week passes. Aisha solves 40 problems and forgets she signed up for anything. The system does not.
Pre-debit notification
Before any money moves, Aisha must be told. This is the pre-debit notification, and RBI's framework says it must reach the customer at least 24 hours before the debit. It has to include the merchant's name, the amount, the date and time, the mandate reference number and the reason. The customer picks how to receive it, by SMS, email or similar.
After the notice, she can opt out of just this one debit, or of the whole mandate, again with AFA. NPCI's page for UPI AutoPay says the same thing in its own words: a Pre-Debit Notification (PDN) at least 24 hours before any execution.
How early Razorpay starts depends on the instrument, and on which page you read: 24 or 36 hours for cards (two answers in the same FAQ), 25 hours for UPI on its recurring payments API. All clear RBI's 24 hour floor. Part 2 sorts them out.
Invoice
On day 7, the new billing cycle opens with an invoice in the issued state. Razorpay creates one for every charge, with one exception, which is exactly Aisha's case: a future start without an upfront amount sends no invoice for the ₹5. So this is her first.
Recurring charge
Then the recurring charge: Razorpay uses the token to debit ₹499, with no PIN and no OTP, because the mandate already covers it.
For UPI there is also a rule about when: under NPCI circular OC 215A, as Razorpay reports it, AutoPay debits cannot run from 10:00 to 13:00 or from 17:00 to 21:30 IST.
Payment states
The charge itself is a payment, and it walks through states. Razorpay's docs list five: created (the attempt started), authorized (the bank approved it), captured (complete, and queued for settlement), failed and refunded.
The gap between authorized and captured matters: an authorized payment that is never captured gets refunded automatically, so Razorpay advises turning on auto capture.
Aisha's payment is captured. Her invoice becomes paid and Razorpay emails her. Her subscription moves from authenticated to active.
Act five: telling StudyNook
StudyNook has to unlock another month for Aisha. It does not poll Razorpay. It waits to be told.
Webhook
A webhook is Razorpay calling StudyNook's server with a JSON message when something happens. On day 7, StudyNook gets subscription.activated (moved to active), subscription.charged (fires on every successful charge) and invoice.paid.
Razorpay's rules are strict. Any response other than 2xx counts as a failure, and so does silence for 5 seconds. Failed deliveries are retried with exponential backoff for 24 hours, then the webhook is disabled. Delivery is at least once, so the same event can arrive twice.
Signature
Anyone can send a POST request to StudyNook's webhook URL. So each real one carries a signature in the X-Razorpay-Signature header: an HMAC SHA256 of the raw request body, keyed with a webhook secret that only StudyNook and Razorpay know. StudyNook recomputes it and compares. No match, no unlock.
The Checkout value from act two works the same way: razorpay_signature is an HMAC SHA256, keyed with StudyNook's key secret, over the payment ID and the subscription ID stored on StudyNook's own server. Part 4 does both checks in code.
Idempotency
Because events can arrive twice, and Razorpay says order is not guaranteed, StudyNook needs idempotency: handling the same event twice must change nothing. The x-razorpay-event-id header is unique per event. Store it, and if you see it again, return 200 and do nothing.
Act six: month three goes wrong
Two months later, the night before the renewal, Aisha's account holds ₹212. The debit fails.
Pending
The subscription moves to pending: an automatic charge failed and retries are still going. StudyNook gets subscription.pending, and gets it again on each failed retry.
For cards, Razorpay's payment retries page (US edition of its docs) gives the schedule: fail at T, retry on T+1, T+2 and T+3. Its test mode docs agree: four failures in a row end the run. For UPI, NPCI allows up to 3 retries against one pre-debit notification, though Razorpay's default UPI template uses fewer, as Part 2 shows.
Halted
After the last retry fails, the subscription is halted. Razorpay still generates invoices, but stops charging them automatically, and past charges are not retried. To get back to active, the customer adds a new card, or an old invoice gets charged manually.
stateDiagram-v2 [*] --> created: POST /v1/subscriptions created --> authenticated: ₹5 authorisation (trial) authenticated --> active: first charge on start_at active --> active: renewal succeeds active --> pending: renewal fails pending --> active: a retry succeeds pending --> halted: retries used up halted --> active: new card or manual charge active --> cancelled: cancel active --> completed: last cycle billed
Dunning
Chasing a failed payment, with retries plus emails asking the customer to fix it, is called dunning. When a card charge fails, Razorpay emails the customer a link to change the card. Part 5 is about this stage, because this is where a subscription can end without anyone ever deciding to cancel.
Aisha tops up her account. The next retry succeeds, and she is back to active.
Act seven: the money moves
Refund
In month four, Aisha writes in. She meant to cancel before the renewal and forgot. StudyNook decides to give the month back, so it issues a refund: the money goes back to the customer, and the payment's state becomes refunded.
Razorpay offers two speeds. Normal refunds reach the customer in 5 to 7 business days. Instant refunds (the optimum speed) try IMPS, NEFT or UPI, and fall back to normal if that does not work.
Settlement
Aisha paid Razorpay, not StudyNook. Settlement is Razorpay moving the collected money to StudyNook's bank account. It is a net amount, and Razorpay gives the formula:
Amount settled = Payment ± Adjustment - Refunds - Fee - Tax - Transfer
A settlement goes from created to processed, or to failed if the bank rejects it. A processed one has a UTR, a bank reference number you can trace.
Settlement cycle
When does it arrive? Razorpay's settlement docs say the standard cycle for domestic payments is T+2 working days, where T is the day the payment was captured, and T+7 for international. Sundays, the second and fourth Saturdays and bank holidays do not count. This "T+N" shorthand is how payment timing is written: T is the day, N is how many working days later.
Razorpay contradicts itself here. Its pricing page lists standard settlement as T+2 working days, but the FAQ on the same page says "typically T+1 or Instant". The schedule on your own Dashboard is the one that applies, and instant settlement is available for a fee.
MDR and fees
The fee comes out first. MDR, merchant discount rate, is the bank charge a merchant pays on a payment. On standard bank to bank UPI it is zero, but Razorpay's pricing blog is careful to say that does not make UPI free: its 2% is a platform fee for the gateway, separate from MDR.
Razorpay's standard rate is 2% plus GST per successful domestic transaction. Its pricing blog says Subscriptions add 0.99% per transaction on top, with 18% GST on the fees only. (Some third party sites quote 0.9%. We did not find that on any Razorpay page.) New merchants activated from July 1, 2026 get a 0% platform fee for 90 days or ₹5 lakh, whichever comes first.
Here is what one ₹499 renewal leaves at those list rates, run on our machine:
python# What lands in the bank from one Rs 499 renewal, at Razorpay's published list rates. # 2% gateway fee + 0.99% Subscriptions fee, 18% GST on the fees only. # Sources: razorpay.com/pricing and Razorpay's pricing blog. Your contract may differ. amount = 499.00 gateway_fee = amount * 0.02 subs_fee = amount * 0.0099 gst = (gateway_fee + subs_fee) * 0.18 settled = amount - gateway_fee - subs_fee - gst for label, value in [("payment", amount), ("gateway fee 2%", -gateway_fee), ("subscriptions fee 0.99%", -subs_fee), ("GST 18% on fees", -gst), ("settled", settled)]: print(f"{label:<26}{value:>9.2f}")
textpayment 499.00 gateway fee 2% -9.98 subscriptions fee 0.99% -4.94 GST 18% on fees -2.69 settled 481.39
That is list pricing, before any refunds, and it ignores the merchant's own taxes on the sale. Real contracts and offers change the numbers.
Chargeback
One last door stays open after the money has moved. If a customer tells their bank a charge was wrong, the bank can open a chargeback: in Razorpay's words, a refund claim the customer starts with their issuing bank, after which the bank begins an official inquiry.
Razorpay tracks these as disputes, with phases (fraud, retrieval, chargeback, pre_arbitration, arbitration), statuses (open, under_review, won, lost, closed) and a respond_by deadline. The merchant can accept, which counts as lost and cannot be undone, or contest with evidence. One evidence field is an access activity log, proof that the customer used the digital product. A lost dispute comes out of the merchant's Razorpay balance.
For StudyNook, a log showing that Aisha solved 40 problems is worth keeping.
flowchart LR P[₹499 captured] ==> F[minus fees and GST] F ==> RF[minus refunds and adjustments] RF ==> ST[settlement created] ST ==> PR[processed, UTR issued] PR ==> BK[StudyNook's bank, T+2 working days] P -. months later .-> CB[chargeback opened] CB -. lost .-> DED[amount deducted from balance]
The whole trip again, now that you know the words
A plan set the price. A subscription with a future start_at made the free trial. Checkout led Aisha to a mandate (UPI AutoPay, card mandate or Emandate), proved with AFA in a ₹5 authorisation transaction, leaving a token behind. On day 7, after the pre-debit notification, an invoice and a recurring charge ran through the payment states. A webhook with a signature, handled with idempotency, told StudyNook. A failed renewal went pending, and dunning kept it from halted. A refund went back, settlement arrived on its settlement cycle minus MDR and fees, and a chargeback stayed possible.
That is subscription billing in one paragraph. The next seven parts are the detail.
What's next
Part 2: How UPI AutoPay and card mandates charge you every month goes deep on act three and act four: the RBI rules from 2019 to the 2026 framework, how the ₹15,000 limit came about, NPCI's retry and peak hour rules, card tokens, and what a merchant actually has to build.
Sources
- RBI: Digital Payments, E-mandate Framework, 2026 (April 21, 2026)
- RBI: Tokenisation, Card transactions, Permitting Card-on-File Tokenisation (CoF) Services (September 07, 2021)
- NPCI: UPI AutoPay product page
- Razorpay Docs: Create a Plan
- Razorpay Docs: Create a Subscription
- Razorpay Docs: Subscriptions workflow
- Razorpay Docs: Subscription states
- Razorpay Docs: Subscriptions FAQs
- Razorpay Docs: Test Subscriptions
- Razorpay Docs: Subscriptions integration guide (checkout signature)
- Razorpay Docs: Payment retries (US edition, card retry schedule)
- Razorpay Docs: UPI Autopay, Create Subsequent Payments
- Razorpay Docs: Order-Payment Relationship (payment states)
- Razorpay Docs: Webhook events
- Razorpay Docs: Validate and test webhooks
- Razorpay Docs: Webhooks
- Razorpay Docs: Webhook best practices
- Razorpay Docs: Set refund speed
- Razorpay Docs: About Settlements
- Razorpay Docs: Disputes entity
- Razorpay Docs: Disputes (accept and contest)
- Razorpay: Pricing
- Razorpay Blog: Payment gateway pricing and fees explained
