Design Airbnb Wallet
Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2021-07-21
Problem Statement
Airbnb wants to launch an in-platform wallet service to allow guests and hosts to seamlessly manage balances, refunds, payouts, and promotional credits. The wallet should handle multi-currency balances, ensure regulatory compliance, and integrate smoothly with external payment gateways and banks.
✅ Functional Requirements
1.<span></span>Wallet Account Management
2.<span></span>Each Airbnb user (guest/host) gets a wallet linked to their profile.
3.<span></span>Support for multi-currency balances.
4.<span></span>View balance, transactions, holds, and settlements.
5.<span></span>Funding Sources
6.<span></span>Add funds via cards, net banking, UPI, or external wallets.
7.<span></span>Handle refunds from cancelled bookings directly into the wallet.
8.<span></span>Credit promotional coupons or Airbnb credits.
9.<span></span>Payments & Payouts
10.<span></span>Guest → Host payments can route via wallet.
11.<span></span>Hosts can withdraw funds to their linked bank accounts.
12.<span></span>Split payments for co-hosts or service providers.
13.<span></span>Transaction Management
14.<span></span>Record all debits/credits with immutable transaction history.
15.<span></span>Support idempotency (no duplicate charges/refunds).
16.<span></span>Handle pending/hold states for bookings until check-in.
17.<span></span>Currency & Conversion
18.<span></span>Multi-currency support with real-time FX rates.
19.<span></span>Lock FX rate at booking time for predictability.
20.<span></span>Security & Compliance
21.<span></span>KYC for hosts (AML, fraud checks).
22.<span></span>PCI DSS compliance for card storage via payment gateways.
23.<span></span>Limits on wallet balance, transactions, daily payouts (jurisdiction-dependent).
⚙️ Non-Functional Requirements
1.<span></span>Scalability: Millions of active wallets, peak booking seasons.
2.<span></span>Reliability: No lost/double transactions; exactly-once guarantees.
3.<span></span>Consistency: Strong consistency for balances, eventual for reporting.
4.<span></span>Performance: P95 transaction latency < 200ms.
5.<span></span>Availability: 99.99% uptime; regional failover for payment infra.
🔐 Constraints & Assumptions
1.<span></span>Wallet must be ledger-based (double-entry accounting).
2.<span></span>Supports refund SLAs: instant wallet refund, T+2 bank refund.
3.<span></span>Hosts expect payouts in local banks; cross-border payments require compliance.
4.<span></span>Promotions/credits must be distinguishable from real money (non-withdrawable).
🧱 Key Components to Design
1.<span></span>Wallet Service – per-user wallet, CRUD operations, holds.
2.<span></span>Ledger Service – immutable double-entry transaction log.
3.<span></span>FX Service – fetch, store, and apply FX rates.
4.<span></span>Payment Gateway Integration – cards, UPI, net banking, PayPal.
5.<span></span>Payout Engine – push funds to host bank accounts (via ACH/SEPA/UPI).
6.<span></span>Fraud & Risk Engine – suspicious transaction detection, velocity checks.
7.<span></span>Notification Service – alerts for credits, debits, low balance.
8.<span></span>Reporting & Analytics – user statements, finance reconciliation.
📈 SLAs & Success Metrics
1.<span></span>Transaction accuracy: 100% (no mismatch in wallet vs. ledger).
2.<span></span>Payout SLA: T+1 for domestic, T+2 for international.
3.<span></span>Fraud detection: <0.01% chargeback rate.
4.<span></span>Latency: Wallet debit/credit <200ms P95.
🔄 Trade-offs to Discuss
1.<span></span>Prepaid balance vs. just-in-time funding (user experience vs. float management).
2.<span></span>Centralized ledger vs. sharded ledgers (consistency vs. scalability).
3.<span></span>Strong consistency (CP) vs. high availability (AP) for wallet transactions.
4.<span></span>In-house FX vs. 3rd-party FX providers (cost vs. control).