Design payment and delivery services for dasher payouts
Company: DoorDash
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
Design and implement two services, Delivery and Payment. The Delivery service exposes delivery events with fields {dasherId, deliveryId, timestamp, status}, where status ∈ {accepted, cancelled, fulfilled}. The Payment service consumes Delivery data and computes earnings per dasher. Define and justify:
1) APIs/interfaces between services (sync vs. async) and request/response schemas;
2) The payout rules (what gets paid on accepted/fulfilled, how cancellations affect pay) and how Payment calculates earnings for a dasher, including totals over a time window and per-delivery breakdowns;
3) Time handling: representation of timestamp, time zones, ordering of events, and how to deal with late or out-of-order events;
4) Data modeling and storage (tables/indexes or in-memory structures) to support ingestion, deduplication, idempotency keys, querying by dasherId and time range, and efficient recalculation;
5) Reliability: error handling, retries, timeouts, circuit breakers—show where you would add try/catch, logging, and metrics;
6) Consistency and reconciliation strategy (e.g., eventual consistency, exactly-once vs. at-least-once semantics, backfill jobs);
7) Service decoupling approaches (message bus, contracts, versioning, backward compatibility) and testing strategies;
8) What the Payment API should return for a typical request (e.g., total-to-date, time-bounded totals, per-delivery line items) and why. If time permits, sketch key classes for both services and core methods for ingesting events and calculating payouts.
Quick Answer: This question evaluates system design competencies around event-driven architecture, API and schema design, data modeling, consistency and reconciliation strategies, time-ordering and idempotency, reliability, and integration/versioning in the payments and delivery domain, and is categorized under System Design.