Code RoomCharge-then-fulfill atomicity
HardPrep Room Coding #3499

Charge-then-fulfill atomicity

System designDatabases & SQLDistributed systemsSenior–Staff~45 min

Design the charge-then-fulfill flow for a digital-goods store where, on a single purchase, you must (1) charge the customer via an external PSP, (2) grant the entitlement in your own DB, and (3) emit a 'purchase.completed' event consumed by downstream services. The PSP call can succeed while your process crashes before granting the entitlement — customer is charged but gets nothing. ~6,000 purchases/sec. No two-phase commit across the PSP. How do you guarantee the customer is never charged without getting the goods, and never gets the goods without being charged?

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.