Design an Airbnb wallet with holds and payouts
AirbnbSoftware Engineer · Technical ScreenLast updated
This question evaluates a candidate's competency in designing financial transaction systems, covering double-entry append-only ledgers, holds/authorizations and captures, refunds and payouts, multi-currency FX conversion and rounding, idempotency, concurrency safety, and auditable reconciliation.
Design and implement an Airbnb-style wallet system. Requirements: (
- create user accounts and allow deposits; (
- support booking holds/authorizations and later captures at check-in; (
- allow hold release on cancellation; (
- process partial/full refunds; (
- pay out hosts after platform fees and taxes; (
- enforce spendable vs. total balance with no negative spendable balance; (
- support multi-currency balances with FX conversion and rounding rules; (
- ensure idempotent operations via client-supplied idempotency keys; (
- guarantee concurrency safety for duplicate or overlapping requests; (
- maintain an append-only auditable ledger and derive balances from it; (
- provide reconciliation to detect inconsistencies; (
- define persistence schema (tables or classes) and transaction isolation choices; (
- expose clear APIs/methods and include a minimal main() to run sample scenarios; (
- write unit tests for happy paths and edge cases (insufficient funds, expired holds, double-capture attempts, partial refunds, FX rate changes). Specify core classes (e.g., Wallet, Account, Transaction, Hold, Capture, Refund, Payout, LedgerEntry, FXConverter), their relationships, and method signatures, and analyze time/space complexity of critical operations.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.