Design a Recurring Billing Engine for UPI Autopay and Card Mandates

Last updated: November 29, 2026

Quick Overview

Design the subscription engine that charges customers on a schedule using UPI Autopay, card e-mandates and eNACH, including the pre-debit notification the regulator requires and retries for failed charges. Merchants define plans, trials and add-ons.

Razorpay
System Design
Software Engineer
Razorpay
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design the subscription engine that charges customers on a schedule using UPI Autopay, card e-mandates and eNACH, including the pre-debit notification the regulator requires and retries for failed charges. Merchants define plans, trials and add-ons.

Razorpay Subscriptions has to fit Indian regulations: mandates must be registered, customers notified about a day before each debit, and debits above a limit need extra authentication. The interviewer wants a scheduler that is exactly-once per billing cycle and a clear model of mandate and invoice states.

What the Interviewer Expects
  • Separate entities: plan, subscription, mandate, invoice, charge attempt
  • Scheduler that creates one invoice per cycle idempotently
  • Pre-debit notification step before execution, with timing guarantees
  • Dunning: retry policy and grace period
  • Handling of mandate revocation and amount caps
  • Time zone and month-end edge cases
Key Topics to Cover
scheduling
idempotency
state machines
regulatory compliance
dunning
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you avoid charging twice if the scheduler runs on two nodes?
  • A customer pauses their mandate in their UPI app. How does your system learn about it?
  • How would you handle proration when a customer upgrades mid-cycle?
  • What happens to 5 million subscriptions all due on the 1st of the month?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Plans with period and amount, subscriptions with start, trial and end; mandate registration via UPI Autopay, card or eNACH; pre-debit notification at least 24 hours before each charge; charge on due d...

High-Level Design

Subscription service stores next_charge_at. A scheduler scans due windows (indexed on next_charge_at, sharded by subscription id range) and for each creates an invoice with a unique key `(subscrip...


Submit Your Answer
Markdown supported

Related Questions