45. Design a Payment System (Stripe / UPI)
1
The interview prompt2
45.1 What do you ask first?3
45.2 How big is this, really?4
45.3 What are the doors?5
45.4 What do we store?6
45.5 What does the whole system look like?7
45.6 How does idempotency work end to end?8
45.7 How does a double-entry ledger work?9
45.8 How does reconciliation work?10
45.9 How do callbacks and webhooks work?11
45.10 How do you keep it consistent?12
45.11 What would you say in the last five minutes?13
Score yourself14
Variations to practise15
Sources16
Code lab45. Design a Payment System (Stripe / UPI)
45.11 What would you say in the last five minutes?
3 min read+10 XP
Step 6: Wrap-up (5 minutes)
- Bottlenecks: ledger writes on hot accounts (bank_clearing, fees): split them into sub-accounts or buckets and roll up; bank adapter limits (rate limiting and multiple acquirers).
- Single points of failure: banks and networks (circuit breakers, routing to alternatives), database shards (synchronous replicas, failover with no lost commits).
- Correctness: idempotency at every hop, double-entry ledger, pending + status checks, daily reconciliation, signed callbacks.
- Security and compliance: card vault and tokens, encryption, audit logs, access controls, and data retention per regulation.
- Next with more time: payouts and settlement schedules, disputes and chargebacks, fraud scoring before authorisation, multi-currency with FX accounts, and subscriptions.
Memory code: "Never twice, never lost, always balanced, proven daily."