Code Room
System designMedium
Question
Design a stored-value wallet that mixes real money and promo/credit balances with different spend rules: promo credits expire, can only be used on certain order types, and must be consumed before real balance; meanwhile concurrent operations (a checkout placing a hold, a refund adding credit, a nightly expiry job) all race on the same wallet. ~60M wallets, peak ~8,000 spends/sec. How do you keep the balance correct, apply the consume-promo-first rule, and ensure an expiry job never voids credit that's already reserved by an in-flight checkout?
What a strong answer looks like
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.
Learn the concepts
Loading whiteboard…
Run or narrate your approach, then ask the coach.