Design a wallet with holds and payouts
I was asked this
No reports yet. Sign in to say where you were asked it.
An object-oriented design interview question asked in Airbnb's technical phone screen, last asked Sep 2025. It tests object-oriented design, payments and ledgers.
Design and implement, in code that runs, a wallet for a rental platform. Guests and hosts have balances. A booking puts the guest's money on hold; the hold is later captured (paid to the host's pending balance) or released; hosts receive payouts; guests can get refunds. Every movement of money is recorded.
Requirements
- Functional: accounts for guests and hosts; deposit; place a hold for a booking; capture or release it; refund all or part of a captured payment; pay out a host's available balance; list an account's transactions.
- Non-functional: balances are always correct and never negative unless allowed; every operation is recorded; retried requests don't move money twice; clear errors for invalid operations.
Clarifying questions
- Are amounts in one currency, as integer minor units (cents)?
- Can a hold be captured for less than its amount?
- When does a host's money become available for payout (after check-in)?
- Is the system single-threaded for this exercise, or must it handle concurrent calls?
What a strong answer covers
- Classes such as
Account(available, held and pending balances),Hold,Transaction(an append-only ledger entry),WalletorPaymentServicewith the operations, and specific errors (InsufficientFunds,HoldNotFound,InvalidState). - A state machine for holds (active, captured, released) and payments (captured, partially refunded, refunded).
- Double-entry style recording, so balances can be rebuilt from the ledger and checked.
- Idempotency keys on every operation that moves money.
- Integer cents, never floats.
- A
mainthat walks through deposit, hold, capture, refund and payout, and tests for the error cases.
Follow-ups
- Two captures of the same hold arrive at once. How do you keep it correct?
- Add multiple currencies.
- The payout provider fails after you marked the payout as sent. How do you recover?
Where it's asked
- Airbnb · Technical phone screen · Last asked Sep 202545 min · One algorithm problem from a small recurring pool
What it tests
object-oriented design · payments · ledgers
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
