45. Design a Payment System (Stripe / UPI)
The interview prompt
This chapter is a full interview round, played out step by step. The interviewer's lines are in quotes. At each step you'll see what a strong candidate says, the pushback the interviewer throws, and how to answer it. At the end, grade yourself with the rubric.
How to use this chapter
- Read only the prompt below. Then stop.
- Set a 45-minute timer and do the whole round yourself, on paper or a whiteboard, out loud. Use the framework from Chapter 1: READ, then Draw, Dive, Defend.
- Then read the walkthrough and compare. Score yourself with the rubric at the end.
The last round of the book is the one where every earlier lesson costs real money if you skip it: idempotency (Chapter 24), transactions (Chapter 17), queues and outboxes (Chapters 22 and 23), and failure handling (Chapter 29). In payments, "we're not sure" is a valid state, and the system must be built to prove, every day, that every rupee is accounted for. For scale: UPI crossed 20 billion transactions in a single month for the first time in August 2025.
The prompt
"Design a payment system like Stripe, which merchants use to accept payments from customers by card or UPI, and which keeps track of the money it owes each merchant."
Stop here. Start your timer.