Design a Driver Payout System
Design a correct, auditable payout flow that turns driver earnings into one externally settled transfer without double spending.
Problem statement
For this exercise, assume a mobility marketplace turns finalized trip earnings into a driver's payable balance and lets the driver request a payout to an external financial account. The source explicitly requires payout correctness, accuracy, and no double spending.
Design the path from durable earning records through available-balance calculation, payout reservation, external transfer, final settlement, and repair of uncertain outcomes.
A driver should be able to view an auditable balance and payout history, request all or part of the available balance, safely retry after a timeout, and observe the eventual payout result. One logical payout must debit the driver's balance at most once and must not create more than one external transfer.
Treat trip pricing, rider charging, tax calculation, foreign exchange, and destination onboarding as outside the initial scope.
What to build
- For this exercise, trusted marketplace systems can record finalized driver earnings and later corrections without silently rewriting financial history.
- For this exercise, a driver can view the available, reserved, and paid balance plus an auditable earning and payout history.
- For this exercise, a driver can request all or part of the available balance and safely retry the request after a timeout.
- For this exercise, the system exposes payout status and reconciles delayed, duplicated, failed, or uncertain external-transfer outcomes.
At scale
- Source fact: payout correctness and accuracy are required, and the same driver funds must not be spent twice.
- Practice assumption: support 5 million active driver accounts, peaks of 5,000 finalized earning records per second, and 500 payout requests per second.
- Practice assumption: acknowledge a valid payout request within 2 seconds when internal dependencies are healthy, while external settlement may remain asynchronous for minutes or longer.
- Practice assumption: external transfer requests and callbacks may be delayed, duplicated, or return an unknown outcome, and financial ledger plus payout audit records are retained for seven years.