Low-Level Design for Splitting a Group Trip Payment
Last updated: November 29, 2026
Quick Overview
Design the classes for letting a trip organizer split a reservation's cost among co-travelers, where each guest pays a share by a deadline and the organizer covers unpaid shares. Show how you split amounts exactly in cents and model the share lifecycle.
Airbnb
November 29, 20260
0
0 solved
Design the classes for letting a trip organizer split a reservation's cost among co-travelers, where each guest pays a share by a deadline and the organizer covers unpaid shares. Show how you split amounts exactly in cents and model the share lifecycle.
Group travel is a large slice of Airbnb bookings, and split payments make money logic and state transitions easy to get wrong. This object-oriented design round checks whether you model money as integers, give each entity clear responsibilities, and make illegal states unrepresentable.
What the Interviewer Expects
- Represent money as integer cents with an explicit currency
- Split totals so shares sum exactly, with a deterministic rule for leftover cents
- Model share states with an enum and guarded transitions
- Separate the domain model from payment gateway calls
- Explain what happens at the deadline
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would you support uneven splits, such as by bedroom?
- What happens when the host changes the price or the trip is cancelled after some guests paid?
- How would you make pay() safe when two devices submit at once?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
A GroupPayment belongs to one reservation and has an organizer and N guests. Each guest gets a Share with an amount and status (PENDING, PAID, EXPIRED). Shares must sum exactly to the total. At th...
High-Level Design
Classes: Share (guest, amount, status), GroupPayment (aggregate root that owns the shares and enforces invariants), and a PaymentService interface (not shown) that charges cards and calls `pay()...