← DoorDash Interview Insights

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

Senior
May 2026

Summary

System design round at DoorDash focused entirely on building a donations platform from scratch. Heavy on transactional correctness and payment infrastructure, which I was not fully prepared for.

Questions Asked (6)

Q1

Design the database schema for a donations platform that supports campaigns, one-time donations, and recurring donations. What entities do you model and how do they relate?

Data ModelingSystem Design
Author's notes

I started with users and campaigns and then kind of free-associated from there: pledges, payments, receipts.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then identify core entities (User, Campaign, Donation, RecurringDonation) and their relationships. Focus on modeling one-time vs recurring donations, and discuss trade-offs like normalization vs performance.

Pro tip: Mention how you'd handle idempotency for donations and the importance of audit trails for financial transactions, showing you think about real-world reliability.

1. Clarify Requirements

Ask about scale, payment methods, and whether recurring donations can be modified or canceled. This ensures the schema meets business needs.

2. Identify Core Entities

List main entities: User, Campaign, Donation, RecurringDonation, and PaymentMethod. Consider if Donation should be a subtype of a Transaction entity.

3. Define Relationships

Map relationships: User to Donation (one-to-many), Campaign to Donation (one-to-many), User to RecurringDonation (one-to-many), and RecurringDonation to Donation (one-to-many).

4. Design Tables and Keys

Specify primary keys, foreign keys, and indexes. For recurring donations, include fields like frequency, next_charge_date, and status.

5. Discuss Trade-offs and Extensions

Talk about normalization vs denormalization for reporting, handling refunds, and supporting multiple currencies. Mention potential sharding by campaign_id or user_id.

Key Points to Mention

  • Separate tables for one-time and recurring donations, or a unified donations table with a type flag.
  • Use of foreign keys to maintain referential integrity between users, campaigns, and donations.
  • Indexing strategies on foreign keys and frequently queried fields like campaign_id and user_id.
  • Handling of recurring donations: storing schedule details and linking to individual donation instances.
  • Consideration of idempotency keys to prevent duplicate donations.
  • Audit logging for financial compliance and debugging.

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

Q2

How would you handle payment failures and retries when integrating with a third-party payment gateway, specifically around idempotency keys, status state machines, and outbox or queue patterns?

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

This is where things got interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem around exactly-once processing and consistency between your system and the gateway. Then walk through the lifecycle: idempotency keys to deduplicate requests, a state machine to track payment status, and an outbox/queue pattern to reliably trigger retries and reconciliation. Emphasize trade-offs like latency vs. consistency and how you handle ambiguous failures.

Pro tip: Mention that idempotency keys must be generated and stored before the first attempt, and that you should never retry on non-idempotent operations without a key. Also highlight the importance of a reconciliation job to catch payments that succeeded on the gateway but failed locally.

1. Clarify requirements and failure modes

Ask about scale, latency tolerance, and what 'payment failure' means (network timeout, gateway decline, etc.). Identify the need for exactly-once processing and consistency.

2. Design idempotency and request deduplication

Explain how to generate a unique idempotency key per payment attempt, store it with the request, and pass it to the gateway. Ensure the key is reused on retries to avoid double charges.

3. Model payment status as a state machine

Define states (e.g., INITIATED, PENDING, SUCCEEDED, FAILED, REFUNDED) and allowed transitions. Use this to drive retries and handle out-of-order events.

4. Implement outbox/queue for reliable retries and events

Use a transactional outbox to atomically persist payment state and enqueue retry/reconciliation messages. A queue with exponential backoff handles transient failures without blocking the main flow.

5. Add reconciliation and monitoring

Run periodic reconciliation jobs to compare local state with gateway reports, resolving discrepancies. Monitor retry rates, latency, and error types to detect issues.

Key Points to Mention

  • Idempotency keys: generate once per payment, store before first attempt, reuse on retries, and handle key expiration.
  • State machine: explicit states and transitions, with idempotent transitions to handle duplicate events.
  • Outbox pattern: atomically write payment record and outbox event in the same DB transaction, then a relay publishes to a queue.
  • Retry strategy: exponential backoff with jitter, max retries, and dead-letter queue for manual intervention.
  • Reconciliation: scheduled job to fetch gateway status for pending payments and update local state.
  • Trade-offs: synchronous vs. asynchronous processing, latency vs. consistency, and cost of reconciliation.

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

Q3

How do you guarantee atomicity and consistency when a user creates a pledge and a payment needs to be recorded at the same time?

System DesignTechnical Trade-offs
Author's notes

Talked through a two-phase approach: write the pledge in a pending state, enqueue the payment job, then update status on callback.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints, such as whether the pledge and payment are in the same database or across services. Then propose a solution using distributed transactions or eventual consistency patterns, explaining trade-offs between consistency, availability, and complexity. Finally, discuss how to handle failures and ensure idempotency.

Pro tip: Mention that you would use the Saga pattern with compensating transactions for cross-service consistency, and emphasize the importance of idempotency keys to handle retries safely. This shows you understand real-world distributed system challenges.

1. Clarify Requirements and Constraints

Ask about the system architecture: are pledge and payment services separate? What consistency level is required? What are the latency and availability requirements?

2. Choose a Consistency Model

Decide between strong consistency (e.g., two-phase commit) and eventual consistency (e.g., Saga pattern). Explain the trade-offs: strong consistency may impact availability and performance, while eventual consistency requires handling intermediate states.

3. Design the Transaction Flow

Outline the steps: create pledge, then record payment. If using Saga, define the sequence of local transactions and compensating actions for rollback. If using 2PC, describe the prepare and commit phases.

4. Ensure Idempotency and Handle Failures

Use idempotency keys to prevent duplicate operations on retries. Implement retry mechanisms with exponential backoff and dead-letter queues for failed compensations.

5. Discuss Monitoring and Recovery

Explain how to monitor transaction states, detect stuck sagas, and provide manual intervention or automated recovery processes.

Key Points to Mention

  • Two-phase commit (2PC) for strong consistency, but note its limitations in distributed systems (blocking, coordinator failure).
  • Saga pattern with choreography or orchestration for eventual consistency, including compensating transactions.
  • Idempotency keys to ensure that retries do not cause duplicate pledges or payments.
  • Outbox pattern to reliably publish events after database transactions.
  • Trade-offs between consistency, availability, and partition tolerance (CAP theorem).
  • Monitoring and alerting for transaction failures and stuck states.

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

Q4

Walk through how you would process chargebacks and partial refunds in your system. What tables are involved and what state transitions happen?

Data ModelingSystem Design
Author's notes

Chargebacks I handled okay since I've dealt with them before.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the scope: chargebacks are external disputes initiated by the customer's bank, while partial refunds are merchant-initiated. Then walk through the data model (payments, orders, ledger, disputes) and the state machine for each flow, emphasizing idempotency and consistency.

Pro tip: Mention that chargebacks and refunds must be idempotent and that you'd use an append-only ledger to track money movement, which is critical for financial correctness and auditability.

1. Clarify requirements and scope

Ask whether the system handles both customer-initiated refunds and bank-initiated chargebacks, and whether partial amounts are allowed. Confirm the need for audit trails and idempotency.

2. Identify core tables

List tables like orders, payments, refunds, chargebacks, and a ledger/transaction table. Explain their relationships and key fields (e.g., payment_id, amount, status).

3. Define state transitions for refunds

Describe the refund lifecycle: requested → approved → processed → completed/failed. Mention how partial refunds update the original payment's refunded amount and status.

4. Define state transitions for chargebacks

Describe the chargeback lifecycle: received → under_review → accepted (merchant loses) or disputed (merchant wins) → closed. Explain how funds are held or reversed.

5. Address consistency and idempotency

Explain how you ensure exactly-once processing using idempotency keys, database transactions, and reconciliation jobs. Mention how the ledger records debits/credits for each event.

Key Points to Mention

  • Idempotency keys to prevent duplicate refunds/chargebacks
  • Append-only ledger for financial audit and reconciliation
  • State machines for refunds and chargebacks with clear transitions
  • Handling partial amounts: updating original payment's refunded amount and remaining balance
  • Database transactions and locking to avoid race conditions
  • Reconciliation with external payment processors (e.g., Stripe, bank webhooks)

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

Q5

How do you reconcile asynchronous webhook events from a payment gateway with your internal payment and pledge state?

System DesignAPI & Integrations
Author's notes

Honestly my weakest answer.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the core challenge: webhooks are at-least-once, out-of-order, and can be delayed, so you need idempotent processing and a source of truth. Then describe a state machine for payments/pledges, with webhooks as one input that triggers transitions, and reconciliation jobs to catch missed events. Emphasize how you handle duplicates, ordering, and consistency between your DB and the gateway.

Pro tip: Mention that you treat the payment gateway as the source of truth for payment status, but your internal state machine decides pledge fulfillment—and you use a periodic reconciliation job to detect and repair drift, which shows you think about failure modes beyond the happy path.

1. Define the state model and source of truth

Map out the possible states for payments and pledges (e.g., pending, authorized, captured, failed, refunded) and clarify which system owns each state. The gateway owns payment status; your system owns pledge lifecycle and business rules.

2. Design idempotent webhook processing

Use a unique event ID from the gateway to deduplicate events, and store processed event IDs. Ensure that applying the same event multiple times results in the same state, typically via upserts or conditional updates.

3. Handle out-of-order and delayed events

Include event timestamps or sequence numbers and only apply transitions if they are newer than the current state. For events that arrive late, either ignore them if superseded or queue them for reconciliation.

4. Implement reconciliation and drift correction

Run periodic jobs that query the gateway for the latest status of pending payments and compare with your internal state. If there's a mismatch, update your state and trigger any necessary downstream actions (e.g., pledge fulfillment or notification).

5. Ensure observability and alerting

Log all webhook events, state transitions, and reconciliation outcomes. Set up alerts for high failure rates, stuck states, or reconciliation mismatches to quickly detect and resolve issues.

Key Points to Mention

  • Idempotency: use event IDs and deduplication to handle at-least-once delivery.
  • Ordering: use timestamps or sequence numbers to reject stale events.
  • State machine: model payment and pledge states explicitly with allowed transitions.
  • Reconciliation: periodic jobs to sync with gateway and repair inconsistencies.
  • Source of truth: gateway for payment status, internal system for pledge logic.
  • Observability: logging, metrics, and alerts for webhook processing and reconciliation.

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

Q6

What does your audit log table look like and what events does it capture across the donation lifecycle?

Data ModelingSystem Design
Author's notes

Short answer: I listed the obvious stuff (pledge created, payment attempted, payment succeeded, refund issued) and mentioned storing actor ID, timestamp, and a JSON blob for the diff.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the purpose of the audit log—compliance, debugging, or analytics—then describe the table schema with key fields like event_id, timestamp, actor, action, and metadata. Walk through the donation lifecycle stages (initiation, payment, fulfillment, completion) and specify the events captured at each stage, emphasizing immutability and query patterns.

Pro tip: Mention that audit logs should be append-only and stored separately from transactional databases to avoid performance impact, and discuss how you'd handle schema evolution for new event types without breaking existing queries.

1. Clarify requirements and scope

Ask whether the audit log is for compliance, debugging, or analytics, as this affects schema design and retention. Confirm the donation lifecycle stages to cover.

2. Define the audit log schema

Describe core columns: event_id (UUID), timestamp, actor_id, actor_type, action, entity_type, entity_id, metadata (JSON), and ip_address. Explain why each is needed.

3. Map events to donation lifecycle

List key events per stage: donation initiated, payment authorized, payment captured, donation completed, refund issued, etc. For each, specify the action name and relevant metadata.

4. Discuss storage and query patterns

Explain append-only design, partitioning by date, indexing on entity_id and timestamp, and how to query for audit trails or analytics. Mention retention and archival policies.

5. Address scalability and compliance

Cover handling high write volume, ensuring immutability (e.g., write-once storage), and meeting regulatory requirements like GDPR or SOX. Mention encryption and access controls.

Key Points to Mention

  • Immutable, append-only design with no updates or deletes
  • Core fields: event_id, timestamp, actor, action, entity, metadata
  • Donation lifecycle events: initiation, payment, completion, refund, cancellation
  • Use of JSON metadata for flexible event-specific details
  • Partitioning and indexing strategies for efficient querying
  • Compliance considerations: retention, encryption, access auditing

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