Reserving a group together
Fans can book up to four places in one order. I built the reservation as a single PostgreSQL transaction. It checks the available stock, places a five-minute hold and saves the price. If the connection drops after checkout, a retry retrieves the same reservation.
When payment meets expiry
The payment handler and the expiry worker both lock the same reservation. An on-time payment issues one QR ticket per place. An expired hold returns the tickets to stock. Replaying a payment event leaves the wallet and the organizer’s revenue unchanged.
Putting the race to a test
Four simultaneous groups each requested four of the ten available tickets. Two groups got all four tickets and two places remained. A separate test replayed payment for three tickets across two servers and produced one paid order and three unique ticket IDs.