PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/System Design/Airbnb

Design and implement an Airbnb wallet

Last updated: Apr 26, 2026

Quick Overview

This question evaluates system design and object-oriented design skills focused on transactional accounting, escrow-based payment flows, idempotency, and robust error handling, plus the ability to produce a runnable in-memory implementation.

  • medium
  • Airbnb
  • System Design
  • Software Engineer

Design and implement an Airbnb wallet

Company: Airbnb

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

Design an Airbnb-style wallet (OOD). Define the classes and methods needed to support wallet balances for guests and hosts, payments, refunds, and payouts. Specify how transactions are recorded and how errors are handled. Then implement runnable code, including your own main function, to demonstrate basic operations and pass sample tests.

Quick Answer: This question evaluates system design and object-oriented design skills focused on transactional accounting, escrow-based payment flows, idempotency, and robust error handling, plus the ability to produce a runnable in-memory implementation.

Related Interview Questions

  • Design a Scalable Job Scheduler - Airbnb
  • Design a Rental Marketplace Backend - Airbnb (hard)
  • Design a booking system - Airbnb (medium)
  • Design a group chat system - Airbnb (medium)
  • Design a real-time chat system with hot groups - Airbnb (hard)
Airbnb logo
Airbnb
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
System Design
13
0

Design an Airbnb-Style Wallet (OOD + Runnable Code)

Context

You are asked to design an in-app wallet system that supports both guests and hosts. The wallet must support wallet balances, payments (guest to escrow at booking time), refunds (escrow to guest), and payouts (escrow to host after stay). The system should record transactions and handle errors robustly. Implement an in-memory, runnable reference in a programming language of your choice.

Assume:

  • Single currency (e.g., USD) and integer amounts in cents to avoid floating point issues.
  • Funds are held in a platform escrow account between payment and payout/refund.
  • In-memory storage is fine; concurrency control can be simple.

Requirements

  1. Roles and Accounts
    • Guest and Host users, each with one wallet.
    • A platform escrow account to hold funds between payment and payout/refund.
  2. Operations
    • Deposit (external → guest wallet)
    • Payment for a booking (guest wallet → escrow), tagged by booking_id
    • Refund (escrow → guest wallet), by booking_id
    • Payout (escrow → host wallet), by booking_id
    • Balance lookup for any wallet and escrow
  3. Transaction Recording
    • Record every operation as an immutable transaction with: id, kind, amount (cents), currency, from_account, to_account, booking_id (optional), timestamp, and idempotency_key (optional).
    • Ability to list or query transactions by booking_id.
  4. Error Handling
    • Insufficient funds
    • Over-refund/over-payout beyond the booking's escrowed amount
    • Currency mismatch
    • Invalid operation (negative/zero amount, unknown user/booking)
    • Idempotency: duplicate requests with the same idempotency_key must not double-spend; if parameters differ, raise an error.
  5. Runnable Code and Demo
    • Provide runnable code (e.g., Python/Java).
    • Include a main function that demonstrates and asserts:
      • Creating a guest and host
      • Deposit $100 to the guest
      • Pay $60 for booking b1
      • Refund $10 for b1
      • Payout $50 for b1 to the host
      • Idempotent duplicate request does not double-apply
      • An error case (e.g., over-refund) is raised
    • Print final balances and a transaction log.

Notes

  • Keep the design clean and extensible (OOD focus), then provide a concise in-memory implementation.
  • Clarity and correctness of invariants (double-entry-style transfers, booking escrow accounting) are more important than advanced infrastructure.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Airbnb•More Software Engineer•Airbnb Software Engineer•Airbnb System Design•Software Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.