Design a Reliable Ticket Confirmation Service
Turn every paid ticket order into exactly one ticket and a delivered confirmation, even when webhooks repeat, workers crash, email fails or an availability zone goes down.
Problem statement
Design the service that confirms ticket purchases. The interviewer cares about one thing above all: very high reliability. Before you design anything, say what reliability means for this system.
For this exercise, assume an event-ticketing website. A buyer picks seats, and a separate booking service holds those seats for 15 minutes. The buyer then pays through an external payment provider. When a payment succeeds, the provider calls your service with a webhook (an HTTP callback) that names the order.
The provider may send the same webhook more than once, may send it late, and occasionally never sends it; you can also ask the provider for an order's payment status.
Your service must turn each paid order into exactly one ticket with a unique ticket code, tell the booking service to mark the seats sold, show the ticket on the buyer's My tickets page, and email the buyer a confirmation.
If the seat hold has already expired when the payment arrives, the booking service may refuse to sell the seats; then your service must not issue a ticket and must start a refund.
Traffic is modest and is not the challenge here. You may draw the design with AWS managed services. Seat selection, the booking service's own design, the payment provider's internals, pricing and fraud checks are out of scope.
What to build
- When an order is reported paid, issue exactly one ticket with a unique ticket code, have the booking service mark its seats sold, and record the order as confirmed.
- Show the ticket on the buyer's My tickets page and email the buyer a confirmation; the buyer or support staff can ask to resend the email.
- Find orders that were paid but are not confirmed, including orders whose webhook never arrived, and finish them.
- When the booking service refuses to sell the seats because the hold expired, issue no ticket, start a refund with the payment provider, and tell the buyer.
At scale
- For this exercise, assume at most about 50 paid orders a second during a popular on-sale and about 3 million tickets a year; capacity is not a design driver.
- For this exercise, assume a paid order should show its ticket on the My tickets page within 1 minute, and no paid order may stay unconfirmed and unrefunded for more than 15 minutes, even while one component or one availability zone is failing.
- For this exercise, assume a confirmed ticket must never be lost, including when an availability zone is lost, and the My tickets page and ticket lookups target 99.95% availability. Email may be delayed, but it is retried for up to 24 hours.