Design a Payment System
How the interviewer asks it
“Design the checkout payment flow for an online store, including retries and refunds.”
Want the full answer? Watch lesson 13 of the free system design course: a 21-minute video walkthrough of this question.
Typed drills are free and unlimited: the AI scores your answer against the outline below.
What the interviewer is looking for
- Idempotency keys end to end, so a retry never charges twice.
- A payment state machine (created, authorised, captured, failed, refunded) stored durably.
- Webhooks from the payment provider handled idempotently, with polling as a fallback.
- A double-entry ledger as the source of truth for money movements.
- Daily reconciliation against the provider's settlement reports.
How to structure your answer
- 01
Requirements
Card and wallet payments through a provider, exactly-once charging from the user's point of view, refunds, audit trail.
- 02
Flow
Order service creates a payment with an idempotency key; payment service calls the provider; the result arrives synchronously or by webhook.
- 03
State machine
Persist each transition; only valid transitions are allowed; retries resume from the stored state.
- 04
Ledger
Every movement is two entries that balance; balances are derived, never edited.
- 05
Failure handling
Timeouts mean "unknown", not "failed": query the provider before retrying. Outbox pattern to publish events.
- 06
Reconciliation and refunds
Match provider reports with the ledger daily; refunds are new ledger entries linked to the original payment.
Best answers from candidates
No candidate answers yet. Type yours, and if it scores 6 or more you can show it here without your name.
Answers are shared by candidates, without names, after a privacy check. Add yours
Common mistakes
- Treating a timeout as a failure and charging again.
- Updating a balance column instead of keeping a ledger.
- Assuming webhooks arrive once and in order.
Follow-up questions to expect
- Split one payment between the store and several sellers.
- The provider is down during a sale.
Now answer it out loud
Max will ask you this exact question, listen to your answer, push on the weak spots with follow-ups like the ones above, and score you when you finish.
Practice with MaxFree: a 5-minute voice round and unlimited typed drills, with scored feedback. No card, and your camera is never recorded.
More system design interview questions
Preparing for this round? Read how to practice for a system design interview.