ProblemTransactions and payments
Subscription billing
NewBill millions of subscribers every month, for years: trials, plan changes, declined cards and Indian debits.
The brief
Streaming subscriptions, India and abroad · suggested for Senior
Design a subscription billing system
Design the billing system of a video streaming service: it turns about 40 million subscriptions, monthly and yearly, in India and abroad, into invoices and charges every period, through trials, plan changes, declined cards and India’s rules for automatic debits.
A video streaming service sells monthly and yearly subscriptions in India and abroad. There are four plans, from a mobile-only plan to a 4K plan for the whole family, and new subscribers get a 7-day free trial. Customers move between plans whenever they like, cancel from the app, and update their card at any time. You build the billing system: it turns each subscription into an invoice and a charge every period, for years. A payment provider stores customers’ cards (and in India sets up their automatic payments) and charges them when you ask; you never see card numbers. Abroad, customers pay by card. In India they pay by card or with UPI AutoPay, and both follow the Reserve Bank of India’s rules for automatic debits: the customer sets up the automatic payment once with an extra authentication step (an OTP or PIN); before every automatic debit they must be told at least 24 hours ahead, with the exact amount and a way to opt out of that debit; a debit above ₹15,000 needs the extra authentication again; and no automatic debit may happen without that advance notice. Renewal payments are sometimes declined: a card has expired, an account is short of money, a card was reported stolen. What a customer can watch must match what they have paid for. Invoices go to customers, to the tax authorities and to finance, and must be explainable years later. A tax service gives you the tax for each invoice, and the company’s accounting system is another team’s. About 2 million renewals fall due on the busiest day of the month. Design the billing system, from a customer starting a trial to their hundredth renewal.
Functional requirements
- CoreCustomers start a subscription on one of four plans, monthly or yearly, with a 7-day free trial for new subscribers.
- CoreEach subscription is billed every period, with an invoice the customer can see, until it is cancelled.
- CoreCustomers move up or down a plan at any time, including part-way through a period.
- CoreCustomers cancel from the app, and update their card at any time.
- CoreRenewal payments are sometimes declined; the company wants to keep customers who mean to stay.
- CoreWhat a customer can watch always matches what they have paid for.
- CoreIndian customers pay by card or UPI AutoPay, under the Reserve Bank of India’s rules for automatic debits.
- CoreThe company’s accounting system learns what was billed, collected and given back.
Non-functional requirements
- ConsistencyA customer is never billed or charged twice for one period, however the billing run fails or repeats.
- DurabilityEvery invoice can be explained years later, with every correction made to it.
- ConsistencyAmounts are exact to the paisa or cent.
- SecurityEvery Indian automatic debit follows the rules in the brief: told at least 24 hours ahead with the exact amount and a way to opt out, approved again above ₹15,000, never debited without that notice.
- LatencyA customer who pays gets access back within a minute.
- AvailabilityEvery renewal is billed on the day it falls due, even on the busiest day of the month.
Scale
- ScaleAbout 40 million subscribers in India and abroad, most on monthly plans (illustrative).
- ScaleAbout 2 million renewals fall due on the busiest day of the month (illustrative).
- ScaleThe payment provider accepts up to about 1,000 charge requests a second from you (illustrative).
- ScaleFour plans, with prices that change a few times a year.
Nice to mention (below the line)
- Below the lineCoupons and discounts.
- Below the lineGift subscriptions.
- Below the lineDashboards and reports for finance.
Out of scope
- Out of scopeUsage-based pricing and metering.
- Out of scopeHow the payment provider reaches banks, cards and UPI.
- Out of scopeThe accounting system and revenue reports.
- Out of scopeDisputes and chargebacks.
- Out of scopeHow tax is computed (a tax service gives you the amount).
The variant
One fully specified brief, with the level it suits best. You can practise it at any level.
- Streaming subscriptions, India and abroadSuggested for Senior
A streaming service bills about 40 million subscribers in India and abroad: trials, renewals, plan changes, declined cards, access, India’s debit rules and the busiest day.
9 steps · 6 must-pass · about 50 min at Senior
What each level is graded on
Streaming subscriptions, India and abroad, step by step. A result at a level needs its must-pass steps answered, and only the steps you answer count. Going up a level adds steps or holds them to a stricter bar.
| Step | Entry level | Mid-level | Your levelSenior | Staff |
|---|---|---|---|---|
| The numbers that shape the design (optional) | Graded | Graded | Graded | Graded |
| Plans, subscriptions and invoices | Must-pass | Must-pass | Must-pass | Must-pass |
| The API the apps call | Graded | Graded | Graded | Graded |
| From a free trial to every renewal after it | Graded | Graded | Graded | Graded |
| The billing run crashes and runs again | Must-passcan block | Must-passcan block | Must-passcan block | Must-passcan block |
| A renewal is declined | Must-pass | Must-pass | Must-pass | Must-pass |
| A plan change halfway through the month | — | Must-pass | Must-pass | Must-pass |
| What a customer can watch while a payment is late | — | Must-pass | Must-pass | Must-pass |
| An Indian subscriber’s renewal | — | — | Must-pass | Must-pass |
| The 1st of the month | — | — | — | Must-pass |
| At this level | 6 steps 3 must-pass about 31 min | 8 steps 5 must-pass about 43 min | 9 steps 6 must-pass about 50 min | 10 steps 7 must-pass about 58 min |
Entry level6 steps · 3 must-pass · about 31 min
- The numbers that shape the design (optional)Graded
- Plans, subscriptions and invoicesMust-pass
- The API the apps callGraded
- From a free trial to every renewal after itGraded
- The billing run crashes and runs againMust-passcan block
- A renewal is declinedMust-pass
Mid-level8 steps · 5 must-pass · about 43 min
- The numbers that shape the design (optional)Graded
- Plans, subscriptions and invoicesMust-pass
- The API the apps callGraded
- From a free trial to every renewal after itGraded
- The billing run crashes and runs againMust-passcan block
- A renewal is declinedMust-pass
- A plan change halfway through the monthMust-pass
- What a customer can watch while a payment is lateMust-pass
SeniorYour level9 steps · 6 must-pass · about 50 min
- The numbers that shape the design (optional)Graded
- Plans, subscriptions and invoicesMust-pass
- The API the apps callGraded
- From a free trial to every renewal after itGraded
- The billing run crashes and runs againMust-passcan block
- A renewal is declinedMust-pass
- A plan change halfway through the monthMust-pass
- What a customer can watch while a payment is lateMust-pass
- An Indian subscriber’s renewalMust-pass
Staff10 steps · 7 must-pass · about 58 min
- The numbers that shape the design (optional)Graded
- Plans, subscriptions and invoicesMust-pass
- The API the apps callGraded
- From a free trial to every renewal after itGraded
- The billing run crashes and runs againMust-passcan block
- A renewal is declinedMust-pass
- A plan change halfway through the monthMust-pass
- What a customer can watch while a payment is lateMust-pass
- An Indian subscriber’s renewalMust-pass
- The 1st of the monthMust-pass
- Must-pass
- a result at that level needs this step answered.
- Can block
- a miss there is a Blocking issue at that level.
Going up a level
- Mid-level
- “Plans, subscriptions and invoices” is graded more strictly.Adds “A plan change halfway through the month”, must-pass.Adds “What a customer can watch while a payment is late”, must-pass.
- Senior
- “A plan change halfway through the month” is graded more strictly.“What a customer can watch while a payment is late” is graded more strictly.Adds “An Indian subscriber’s renewal”, must-pass.
- Staff
- Adds “The 1st of the month”, must-pass.
Skills this problem practises
Your coach tracks readiness per skill across every problem you practise. Each links to the lesson that teaches it.
- Requirements and scope
- Capacity estimation
- API design
- Idempotency and retries
- Data modelling
- High-level architecture
- Queues and async messaging
- Traffic surges and backpressure
- Consistency and concurrency
- Failure modes and recovery
- Observability and operations
Worked solution
Try it first: practise a variant, then read the walkthrough and compare it with your own design. Reading it first makes the practice much less useful.
Learn: Design a subscription billing systemYour history
Sign in to see your sessions on this problem.