Design an Amazon Gift Card Balance Ledger With Double-Entry Accounting
Last updated: November 29, 2026
Quick Overview
Design the service that stores gift card balances, applies redemptions, spends at checkout and refunds, so that every balance can be audited and money is never created or lost.
Amazon
November 29, 20260
0
0 solved
Design the service that stores gift card balances, applies redemptions, spends at checkout and refunds, so that every balance can be audited and money is never created or lost.
Payments teams at Amazon expect candidates to reason like accountants as well as engineers. The interviewer checks double-entry modeling, idempotent operations, concurrency on a single balance, and how balances are derived and audited.
What the Interviewer Expects
- Model money movements as balanced journal entries
- Make every operation idempotent with a client request id
- Prevent overspend under concurrent checkouts
- Derive balances from entries and cache them safely
- Support audit, reversals and reporting
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How would you handle a checkout that authorizes gift card funds but the order is later canceled?
- How do you detect a ledger that does not balance?
- How would you support multiple currencies across marketplaces?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: redeem a claim code into a customer's balance; spend balance at checkout (possibly partially); refund back to balance; expire or reverse fraudulent loads; show balance and history. Non-fun...
High-Level Design
A Ledger service exposes post(entry) where an entry has a unique request_id and two or more lines that sum to zero, for example redeem: debit gift_card_liability_pool, credit `customer:123:gc_ba...