Design a Wallet Ledger for Split Tender Payments
Last updated: November 29, 2026
Quick Overview
Design the ledger behind a digital wallet that lets a customer pay for one order with a mix of gift card balance, a credit card and store credit from a return. The ledger must never lose or duplicate money and must support partial refunds and order changes after checkout.
Walmart Labs
November 29, 20260
0
0 solved
Design the ledger behind a digital wallet that lets a customer pay for one order with a mix of gift card balance, a credit card and store credit from a return. The ledger must never lose or duplicate money and must support partial refunds and order changes after checkout.
Walmart Pay and online checkout handle split tender, substitutions that lower the final total, and partial returns, so the amount captured often differs from the amount authorized. Interviewers probe double-entry modeling, idempotency across external processors, and how to keep balances correct when refunds and order edits race.
What the Interviewer Expects
- Use a double-entry, append-only ledger with balanced postings
- Model authorize, capture, void and refund as separate states
- Allocate amounts across tenders with a clear priority rule
- Make every external call idempotent and reconcilable
- Explain how balances are read quickly without breaking correctness
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
- A grocery substitution lowers the total by $4.17 after authorization. What postings happen?
- How do you allocate a partial refund across a gift card and a credit card?
- How do you reconcile with the card processor's daily settlement file?
- How would you shard the ledger as volume grows?
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
Support tenders: gift card (internal balance), store credit (internal), external credit or debit card. Operations: authorize at checkout, capture at fulfillment (possibly a smaller amount), void lefto...
High-Level Design
- Payment Orchestrator: receives
checkout(order_id, amount, tenders)with an idempotency key, runs a saga across tenders. - Ledger Service: append-only `entries(entry_id, txn_id, account_id,...