Design a Payment System With Holds and Settlement
Design a payment platform in the style of Stripe. A merchant integrates through an API, a payer initiates a charge, the system places a real-time hold on the payer's funds through the bank or card network, and the money is settled to the merchant later in batches. Merchants are told about successes and failures through webhooks.
The interviewer follows three threads: how a retried request avoids charging twice, how the hold and the later settlement stay consistent, and what happens when the bank call times out or a component fails part-way through a charge. Peak load during a sale is high, the availability target is 99.99%, and card data needs PCI-style isolation.
Some loops give this ten minutes at a high level before moving to a project deep dive, and others spend the whole hour on consistency and failure cases. Prepare both depths.
Hints
Hint 1
Start with the states of a payment intent and the legal transitions: created, authorized (held), captured, settled, failed, refunded. Sharding comes much later.
Hint 2
An idempotency key supplied by the client and stored with the result turns a retry into a lookup. The key record and the intent's state change must commit together.
Hint 3
A timeout from the bank is not a failure, it is an unknown. Record the attempt before calling out, and resolve unknowns by querying the network and by reconciliation.
Asked at
Sign in to talk to the interviewer — ask what's in scope, what scale to design for, or for a nudge when you're stuck. Conversations save to your account.
Sign in to use the assistant — ask what the problem means, get a hint when you're stuck, or have your current work reviewed. Conversations save to your account.