Design Idempotent Checkout That Never Double Charges a Customer
Last updated: November 29, 2026
Quick Overview
Design the DoorDash checkout path that creates an order and charges the customer's card exactly once, even when the app retries on timeouts, the user taps Place Order twice, or a downstream service fails midway.
DoorDash
November 29, 20260
0
0 solved
Design the DoorDash checkout path that creates an order and charges the customer's card exactly once, even when the app retries on timeouts, the user taps Place Order twice, or a downstream service fails midway.
Checkout spans cart, promotions, order, payment and dispatch services, and duplicate charges trigger support contacts and chargebacks. Interviewers focus on idempotency keys, authorization versus capture, and a saga that cleans up after partial failure, rather than general payment gateway architecture.
What the Interviewer Expects
- Generate a client idempotency key per checkout attempt and store results
- Use authorize at checkout and capture after fulfillment
- Design the checkout as a saga with compensations
- Handle unknown outcomes from the payment processor
- Make order creation and payment linkage atomic enough to avoid orphans
- Add reconciliation for leftovers
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- What does the server return when a retry arrives while the first attempt is still in progress?
- How do you handle a promo code consumed by an attempt that later fails?
- When should the final amount differ from the authorized amount, and how is that handled?
- How would you test this flow for duplicate charges before launch?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
The customer taps Place Order. We validate cart and price, reserve promos, create the order, authorize payment, and hand off to the merchant and dispatch. Requirements: exactly one order and one charg...
High-Level Design
- Client creates
checkout_id(UUID) when the checkout screen loads, and sends it on every Place Order attempt. - Checkout orchestrator persists `checkout_attempt(checkout_id, state, order_id...