25
Payment / Wallet System
Idempotent, double-entry, sagas vs 2PC.SavedSaved on this device — Saved on this device
01Clarifications
What would you ask before drawing a single box?
Ambiguity you would resolve with the interviewer: scope, scale, who uses it, what counts as done.
AI staff engineer
Enter to send · Shift+Enter for a new line
About Payment / Wallet System
Idempotent, double-entry, sagas vs 2PC.
- Difficulty
- advanced
- Time
- about 50 minutes
- Stages
- 10
- Topic
- Transactions, Concurrency & Money
How this problem is worked
Ten stages, from the questions you would ask an interviewer to the trade-offs you would defend. Each asks one question, and the simulator runs the architecture you draw against the requirements you wrote.
- 01ClarificationsWhat would you ask before drawing a single box?
- 02Functional reqsWhat must this system actually do?
- 03Non-functionalWhat must it promise about speed, uptime and correctness?
- 04Capacity estimationHow much load and data does this have to hold?
- 05API designWhat does the outside world call, and what comes back?
- 06Data modelWhat gets stored, and what is it looked up by?
- 07Use-case breakdownHow does each requirement actually get served?
- 08High-level designWhich components handle a request, and in what order?
- 09Deep divesWhich part breaks first, and what do you do about it?
- 10Trade-offsWhat did this design cost, and what breaks at 10×?
Primary sources for this problem
- Brandur — Implementing Stripe-like Idempotency Keys in Postgres
- Stripe — Designing robust APIs with idempotency
- Square — Books: an immutable double-entry accounting database
- Monzo — Speeding up balance reads (ledger)
- Uber — Engineering Uber's Next-Gen Payments Platform (Gulfstream)
- Airbnb — Avoiding double payments (Orpheus)
- Garcia-Molina & Salem — Sagas (1987)
- Debezium — Outbox pattern
More in Transactions, Concurrency & Money
Correctness when two writers collide and money is involved: serializability, two-phase commit versus sagas, hold-then-confirm, single-writer matching, and the databases that give you external consistency.
Browse the full problem catalog, or see what the simulator does and does not model.