Code RoomTry-Confirm-Cancel booking and pay
HardPrep Room Coding #3504

Try-Confirm-Cancel booking and pay

System designDatabases & SQLDistributed systemsSenior–Staff~45 min

Design a booking-and-pay flow using a Try-Confirm-Cancel (TCC) pattern: a reservation must tentatively hold a hotel room (try), tentatively authorize the card (try), and only if BOTH tries succeed do you confirm both; if either fails or times out you cancel both. ~4,000 bookings/sec. The room-hold and the card-auth live in different services with no shared transaction, holds expire, and the confirm/cancel messages can be lost. How do you guarantee you never confirm a payment for a room you couldn't hold, or hold a room for a payment you couldn't take?

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts (data model, bottlenecks, consistency, failure modes) and name the trade-offs you are making.

Clarify5:00 left
Estimate5:00 planned
Design15:00 planned
Deep dive12:00 planned
Failure8:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.