← DoorDash Interview InsightsSoftware Engineer

DoorDash·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
Jun 2026

Summary

System design round at DoorDash focused entirely on payment reliability. The whole session was a deep dive into idempotency and what happens when things go wrong mid-transaction. Pretty intense if you haven't thought carefully about distributed payments before.

Questions Asked (6)

Q1

A user clicks 'Pay' multiple times because the network is slow or the upstream processor is timing out. How do you design the system to guarantee they're never charged more than once, while keeping the service available?

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

This is the core question and it sprawls fast.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer around idempotency as the core mechanism, then layer in distributed systems considerations like deduplication keys, database constraints, and graceful degradation under upstream failures. Walk through the full request lifecycle — from the client click to the payment processor response — identifying exactly where duplicate charges can occur and how each layer defends against them.

Pro tip: Mention that idempotency keys should be generated client-side (e.g., a UUID tied to the cart/order session) rather than server-side, so that even if the client retries before receiving any server response, the same key is reused — this is how Stripe and most payment APIs handle it in production.

1. Identify the Failure Scenarios

Start by enumerating where duplicate charges can originate: client-side double-clicks, client retries after a timeout, server retries to the upstream processor, and network duplicates. This shows you understand the problem space before jumping to solutions.

2. Introduce Idempotency Keys

Explain that the client generates a unique idempotency key (e.g., UUID) per payment intent and attaches it to every retry of the same request. The server stores this key with the outcome so any duplicate request returns the cached result without re-processing.

3. Enforce Deduplication at the Server Layer

Describe using a database or distributed cache (e.g., Redis) to atomically check-and-insert the idempotency key before forwarding to the payment processor, using a unique constraint or a distributed lock to prevent race conditions under concurrent retries.

4. Handle Upstream Processor Timeouts Safely

Address the trickiest case: when the call to the payment processor times out and you don't know if it succeeded. Explain strategies like storing a 'pending' state, querying the processor for the transaction status before retrying, and passing the same idempotency key to the processor so it also deduplicates on its end.

5. Maintain Availability and Observability

Discuss keeping the service available during processor slowdowns via timeouts, circuit breakers, and async status polling with user feedback (e.g., 'Payment processing…'). Add that you'd monitor idempotency key collision rates and duplicate-charge alerts as key operational metrics.

Key Points to Mention

  • Client-side idempotency key generation (UUID scoped to the order/cart session) reused across all retries
  • Atomic check-and-insert of the idempotency key in a database with a unique constraint or Redis SET NX to prevent race conditions
  • Passing the idempotency key through to the upstream payment processor (e.g., Stripe's Idempotency-Key header) so deduplication is enforced end-to-end
  • Handling the ambiguous timeout case: storing a 'pending' state and reconciling via a status-check or webhook before any retry reaches the processor
  • Circuit breaker pattern to stop hammering a slow processor while still returning a meaningful response to the user
  • Observability: alerting on duplicate key hits, failed reconciliations, and any confirmed double-charge events for rapid incident response

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

When a payment request times out and you don't know whether the upstream processor actually charged the user, how do you handle that ambiguity?

System DesignTechnical Trade-offs
Author's notes

Blanked for a second here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer around the principle of idempotency and safe retry mechanisms, demonstrating that you understand the core challenge is avoiding double-charges while also ensuring the payment eventually succeeds. Walk through a concrete decision tree that covers detection, reconciliation, and resolution, showing you've thought about both the technical implementation and the user experience impact.

Pro tip: Mention that you'd design the system to be 'pessimistic on retries' — defaulting to treating an unknown state as a potential success before querying the processor — because a double-charge is far more damaging to user trust than a delayed order. This shows product-aware engineering judgment that DoorDash values.

1. Acknowledge the Ambiguity

Explicitly state that a timeout means you have three possible states: the charge succeeded, it failed, or it's still in-flight. Never assume a timeout equals failure, as this is the root cause of double-charge bugs.

2. Use Idempotency Keys

Explain that every payment request should be issued with a unique, client-generated idempotency key so that any retry of the same logical transaction is safely deduplicated by the upstream processor. This is the foundational safeguard that makes the rest of the strategy safe.

3. Query Before Retrying

Before issuing any retry, call the processor's status/lookup endpoint using the original transaction ID or idempotency key to determine the actual outcome. Only proceed with a retry if the processor confirms the original request never landed or definitively failed.

4. Implement Async Reconciliation

For cases where the status query also times out or returns an ambiguous result, place the order in a 'pending' state and use a background reconciliation job that polls or listens to processor webhooks to resolve the final state. This decouples the user-facing flow from the uncertainty.

5. Handle User Communication and Fallback

Define a clear user-facing policy: inform the user of the pending state, set a resolution SLA (e.g., 5 minutes), and if unresolved, err on the side of not charging and canceling the order rather than risking a double-charge. Log all ambiguous events for manual review and alerting.

Key Points to Mention

  • Idempotency keys as the primary defense against duplicate charges on retries
  • The three-state problem: success, failure, and in-flight — never conflate timeout with failure
  • Processor-side status/lookup APIs to resolve ambiguity before retrying
  • Webhook or event-driven reconciliation as an asynchronous resolution mechanism
  • Distributed saga or compensating transactions if the payment is part of a larger multi-step workflow (e.g., order creation + payment + restaurant notification)
  • Observability: dead-letter queues, alerting on unresolved pending states, and audit logs for financial compliance

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

How long should idempotency keys be retained on the server, and what factors influence that decision?

System DesignData Modeling
Author's notes

Short answer: long enough to cover any realistic retry window, but storage isn't free.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer around the business and operational tradeoffs, starting with the core purpose of idempotency keys (preventing duplicate operations) and then systematically walking through the factors that determine an appropriate retention window. Ground your reasoning in real-world constraints like client retry behavior, storage costs, and compliance requirements to show practical engineering judgment.

Pro tip: Mention that at scale (like DoorDash's order volume), retention decisions directly impact storage costs and database query performance, so you'd advocate for tiered storage — keeping recent keys in fast cache (Redis) with a short TTL and archiving older records to cheaper storage — rather than a one-size-fits-all approach.

1. Define the Core Purpose

Start by anchoring the discussion: idempotency keys exist to deduplicate retried requests within a meaningful window, so retention must outlast the longest realistic retry cycle. This sets the baseline minimum retention period.

2. Identify Client Retry Behavior

Discuss how client retry policies (exponential backoff, max retry duration, network timeout windows) directly dictate the minimum safe retention period. For most payment or order systems, this typically ranges from 24 hours to 7 days.

3. Weigh Business and Compliance Factors

Address domain-specific requirements such as financial regulations (e.g., audit trails for payment idempotency), SLA commitments, and dispute resolution windows that may extend retention well beyond the technical minimum.

4. Evaluate Storage and Performance Tradeoffs

Discuss the cost of retaining keys — storage overhead, index size, and lookup latency — and propose strategies like TTL-based expiration, tiered storage (hot cache vs. cold DB), or partitioning by time to manage scale efficiently.

5. Recommend a Concrete Policy with Flexibility

Conclude with a concrete recommendation (e.g., 24–72 hours in Redis for active deduplication, 30 days in persistent storage for auditing) while noting that the policy should be configurable per operation type or criticality.

Key Points to Mention

  • Client retry window and maximum backoff duration as the baseline minimum retention period
  • Tiered storage strategy: fast in-memory cache (Redis with TTL) for hot deduplication, durable DB for audit/compliance
  • Domain sensitivity — payment and order operations may require longer retention for dispute resolution or regulatory compliance
  • Storage cost and index performance degradation at high key volume, and how partitioning or TTL mitigates this
  • Operation criticality as a factor — idempotency keys for financial transactions warrant longer retention than non-critical read operations
  • Monitoring and alerting on key expiration to detect clients retrying after the retention window has lapsed

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How do you handle deduplicating concurrent retries, where multiple in-flight requests with the same idempotency key arrive at the server simultaneously?

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

This is where I stumbled.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame the problem as a distributed systems concurrency challenge and walk through a layered solution: first establish a shared, atomic locking mechanism to serialize concurrent requests with the same idempotency key, then describe how to store and replay the canonical response. Ground your answer in real trade-offs (latency vs. correctness) and mention how this applies at DoorDash's scale with high-volume order and payment flows.

Pro tip: Interviewers at companies like DoorDash are looking for candidates who recognize that a simple database unique-constraint check is insufficient under concurrency — explicitly calling out the 'check-then-act' race condition and proposing an atomic compare-and-set or distributed lock (e.g., Redis SET NX with TTL) signals senior-level thinking.

1. Define the Problem & Race Condition

Articulate that the core danger is two requests with the same idempotency key passing a uniqueness check simultaneously before either has written a result, potentially causing duplicate side effects. Make clear this is a classic TOCTOU (time-of-check to time-of-use) race condition.

2. Introduce an Atomic Locking Layer

Propose using an atomic, distributed lock — such as Redis SET NX PX (set-if-not-exists with TTL) — to ensure only one request proceeds with execution while others wait or receive a 'processing' status. Explain why a database unique index alone is insufficient without this serialization step.

3. Persist State with a Status Machine

Describe storing the idempotency record in a durable store (e.g., PostgreSQL) with a status field (PENDING → PROCESSING → COMPLETED/FAILED) so that concurrent waiters can poll or be redirected to the stored result once the primary request finishes. This decouples lock acquisition from response retrieval.

4. Handle Lock Expiry & Failure Scenarios

Address edge cases: if the lock holder crashes mid-execution, the TTL releases the lock and a retry can re-acquire it, but the system must be idempotent at the business logic level too. Discuss fencing tokens or versioning to prevent stale lock holders from committing results out of order.

5. Discuss Trade-offs & Scaling Considerations

Weigh latency impact of synchronous locking vs. optimistic concurrency (unique DB constraint + retry on conflict), and mention sharding idempotency keys to avoid hot-spots in Redis or the database. Tie back to DoorDash's context — e.g., payment deduplication where exactly-once semantics are critical.

Key Points to Mention

  • TOCTOU race condition: why a naive uniqueness check is not atomic and can be bypassed under concurrency
  • Atomic distributed lock using Redis SET NX with a TTL as a first-line serialization primitive
  • Idempotency record state machine (PENDING → PROCESSING → COMPLETED) stored in a durable database to allow safe result replay
  • Lock expiry and crash recovery: using TTLs plus fencing tokens to handle partial failures without re-executing side effects
  • Optimistic concurrency as an alternative: relying on a unique DB constraint and catching conflict errors to retry or return the stored result
  • Scalability concerns: key sharding, hot-spot avoidance, and the latency cost of synchronous locking vs. eventual consistency trade-offs

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

What UX changes would you pair with the backend idempotency design to reduce duplicate payment attempts in the first place?

System DesignTechnical Trade-offs
Author's notes

Easier part of the conversation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer by acknowledging that idempotency is a safety net, but great UX should prevent users from ever needing to retry in the first place. Walk through the user journey at checkout to identify friction points that cause accidental double-taps or impatient re-submissions, then propose concrete UI/UX mitigations paired with how they complement the backend design. Show that you think holistically across the full stack, not just the API layer.

Pro tip: Interviewers at companies like DoorDash love candidates who quantify impact — mention that even a 200ms loading indicator or a disabled submit button can reduce duplicate payment events by a significant percentage, signaling you think in terms of measurable outcomes, not just features.

1. Identify Root Causes of Duplicate Attempts

Start by diagnosing why users submit payments multiple times — slow feedback, network timeouts, accidental double-taps on mobile, or page refreshes. Grounding your UX suggestions in real causes shows analytical depth.

2. Disable and Provide Immediate Visual Feedback

Propose disabling the 'Place Order' button immediately on first tap and showing a loading spinner or progress indicator so users know the action was registered. This single change eliminates the majority of impatient re-taps.

3. Communicate Processing State Clearly

Design clear in-progress states with estimated wait times (e.g., 'Processing your payment…') and avoid ambiguous blank screens that prompt users to retry. Transparent status messaging reduces anxiety-driven duplicate submissions.

4. Handle Network Failures Gracefully on the Client

Implement client-side retry logic with exponential backoff using the same idempotency key, rather than letting the user manually retry, so the UX layer and backend idempotency design work in concert. Show a user-friendly error only after retries are exhausted.

5. Confirm Success Unambiguously and Prevent Back-Navigation Re-submission

Redirect to a clear order confirmation page after success and use the Post/Redirect/Get pattern or replace browser history to prevent form re-submission on back-button or page refresh. This closes the loop and ensures the user never accidentally re-triggers the payment flow.

Key Points to Mention

  • Disabling the submit button on first click and showing a loading/spinner state to prevent impatient double-taps
  • Client-side idempotency key generation (e.g., UUID per checkout session) so retries from the frontend always carry the same key as the backend expects
  • Optimistic UI patterns balanced with accurate error recovery to keep users informed without misleading them
  • Post/Redirect/Get (PRG) pattern or history replacement to prevent browser refresh from re-submitting the payment form
  • Clear, differentiated error states — distinguishing 'still processing' from 'payment failed' so users know whether to wait or retry intentionally
  • Timeout thresholds and user-facing messaging that set expectations (e.g., 'This may take up to 10 seconds') to reduce anxiety-driven retries

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

Where do you draw the line between strong consistency and availability when parts of the payment infrastructure are degraded?

Technical Trade-offsSystem Design
Author's notes

Classic CAP territory.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer around the CAP theorem and explain that for payments, the default posture leans toward consistency to prevent financial harm, but with carefully scoped fallbacks that preserve availability for non-critical paths. Use a concrete degradation scenario (e.g., payment processor timeout) to walk through your decision-making process, showing you understand the business impact of each trade-off.

Pro tip: Demonstrate that you think in terms of 'blast radius' — rather than a binary consistency-vs-availability choice, show that you design systems to isolate failures so that a degraded component affects the smallest possible subset of transactions, and that you have explicit runbooks for each degradation tier.

1. Anchor on Business & Safety Requirements

Start by clarifying what 'degraded' means and what the non-negotiable invariants are — e.g., no double charges, no lost payments, no unauthorized debits. Establish that these invariants dictate where consistency must be preserved regardless of availability pressure.

2. Classify Operations by Consistency Criticality

Segment payment operations into tiers: idempotent reads (can tolerate stale data), state-mutating writes like charge/refund (require strong consistency or must fail safely), and advisory operations like fraud scoring (can degrade gracefully). This segmentation lets you apply different consistency policies per operation type.

3. Define Degradation Modes & Fallback Strategies

For each failure scenario — processor outage, database partition, downstream timeout — specify the exact fallback: queue-and-retry with idempotency keys, circuit breakers that return a pending state, or graceful denial with a user-facing retry prompt. Make clear that 'available but wrong' is worse than 'unavailable but honest' for money movement.

4. Leverage Idempotency & Saga Patterns

Explain how idempotency keys and distributed sagas allow you to safely retry or compensate without risking duplicate charges, effectively buying availability without sacrificing correctness. Mention how DoorDash's order lifecycle (place → charge → fulfill → refund) maps naturally to a saga with compensating transactions.

5. Observability, Alerting & Human Escalation

Describe how you instrument the system to detect when it has shifted into a degraded consistency mode — dashboards, anomaly detection on charge success rates, and on-call runbooks. Emphasize that automated fallbacks should always be paired with human visibility so engineers can decide when to restore full consistency.

Key Points to Mention

  • CAP theorem and PACELC — explicitly choosing CP over AP for money-movement operations, and the latency vs. consistency extension under normal operation
  • Idempotency keys to make retries safe and prevent duplicate charges even when network partitions cause ambiguous outcomes
  • Saga pattern with compensating transactions to handle multi-step payment flows (authorize → capture → settle) without distributed locks
  • Circuit breakers and bulkheads to isolate a degraded processor or database shard so failures don't cascade across the entire payment stack
  • Optimistic vs. pessimistic locking trade-offs — using optimistic concurrency for high-throughput reads but pessimistic or serializable isolation for balance mutations
  • Observability and SLO-based alerting to detect consistency drift early and trigger automated or manual remediation before financial discrepancies accumulate

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.