Design Tipping System

Easy30 min
1 / 30
understanding9 min read

Problem Statement: Post-Trip Tipping on Ride & Delivery Platforms

Problem Statement: Post-Trip Tipping on Ride & Delivery Platforms — tipping system design depth

Problem Statement: Post-Trip Tipping on Ride & Delivery Platforms

Drivers at Uber treat tips as latency-sensitive compensation signal; your design must credit wallets without blocking the rider rating flow.

ConcernDesign stance
Truth sourceAppend-only tip_ledger_event — never adjust driver balance without an event
Fare basisPercentage tips compute on locked fare_subtotal_cents at trip completion
CaptureIdempotent POST with Idempotency-Key; separate tip intent when refunds are common
PayoutConnect transfer after CAPTURED; instant payout optional with explicit fee

Section focus (sec-001): Uber and Lyft riders tip after trip completion; DoorDash and Instacart tip at order handoff. Money must never disappear between rider card capture and driver wallet credit.

Capacity signal: evening peak ~14k tip authorizations/s in primary region

javaOne Dark Pro
1public record TipIntent(String tripId, int tipCents, String riderId, String state) {}
2public final class TipLedgerEvent {
3 private final String eventType; // AUTHORIZE, CAPTURE, TRANSFER, REVERSE
4 private final long occurredAtEpochMs;
5}
pythonOne Dark Pro
1def compute_percent_tip(subtotal_cents: int, percent: int) -> int:
2 raw = subtotal_cents * percent // 100
3 return min(raw, subtotal_cents * 2) # 200% cap
typescriptOne Dark Pro
1export interface CreateTipRequest {
2 tripId: string;
3 tipCents: number;
4 idempotencyKey: string;
5 presetId?: "p15" | "p20" | "p25" | "custom";
6}

Operational trace (sec-001)

Scenario 1: rider selects 20% preset on a $24.50 subtotal, API returns AUTHORIZED in 180ms, webhook confirms capture, payout worker enqueues transfer to driver Connect account. Finance reconciles PSP settlement batch IDs to tip.captured events keyed by trip_id.

On-call metrics: ledger_psp_mismatch_bps, tip_edit_after_transfer_count, instant_payout_failure_rate — sustained mismatch above 5 bps triggers SEV2.

Interview pivot (understanding): If challenged on cash tips, log driver-reported cash as non-authoritative analytics only. For combined fare+tip charge, show refund decomposition table before committing.

Why interviewers care

Tipping System interviews reward crisp scope, explicit trade-offs, and failure stories—not generic microservice diagrams.

Interview checkpoint

Name one failure story for Problem Statement: Post-Trip Tipping on Ride & Delivery Platforms that proves you understand real outages, not happy-path diagrams.

Key Highlights

  • Ledger append-only invariant (sec-001)
  • Fare snapshot before percent tip (1)
  • Idempotent tip capture (understanding)
  • Connect payout after CAPTURED (0)
pro tip
sec-001: Write tip state machine on the whiteboard before naming databases.
interviewer loves
sec-001: State percent tip basis (subtotal vs total) aloud early.
common mistake
sec-001: Mutating driver.balance without tip_ledger_event—chargebacks become unprovable.
trade off
sec-001: Combined fare+tip charge improves UX but complicates partial refunds.

Section Rescue Kit

Buzzwords to use:

Tip ledger eventConnect instant payout

Safe statements:

  • "Before storage on Problem Statement: Post-Trip Tipping on Ride & Delivery Platforms, I'll state tip_cents is immutable after TRANSFER_STARTED."
  • "I'll separate trip pricing service from tip settlement on the diagram."
Design Tipping System - System Design | WinJob | WinJob