Design an Airbnb wallet with holds and payouts
Company: Airbnb
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
Design and implement an Airbnb-style wallet system. Requirements:
(
1) create user accounts and allow deposits;
(
2) support booking holds/authorizations and later captures at check-in;
(
3) allow hold release on cancellation;
(
4) process partial/full refunds;
(
5) pay out hosts after platform fees and taxes;
(
6) enforce spendable vs. total balance with no negative spendable balance;
(
7) support multi-currency balances with FX conversion and rounding rules;
(
8) ensure idempotent operations via client-supplied idempotency keys;
(
9) guarantee concurrency safety for duplicate or overlapping requests;
(
10) maintain an append-only auditable ledger and derive balances from it;
(
11) provide reconciliation to detect inconsistencies;
(
12) define persistence schema (tables or classes) and transaction isolation choices;
(
13) expose clear APIs/methods and include a minimal main() to run sample scenarios;
(
14) 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.
Quick Answer: 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.