← Questions

Design a wallet with holds and payouts

0
AirbnbOO designLast asked Sep 2025

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), Wallet or PaymentService with 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 main that 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

What it tests

object-oriented design · payments · ledgers

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing