Design the payments service for a subscription and usage-billing product. Customers pay with cards through an external payment processor. The service charges them, records every movement of money, and stays correct when networks fail halfway through.
Functional:
- Charge a customer for a subscription renewal or a usage invoice.
- Refund all or part of a charge.
- Show a customer their payment history and current balance.
- Handle processor webhooks for asynchronous outcomes such as successes, failures, and disputes.
Non-functional:
- Never charge a customer twice for the same invoice, even when a request is retried after a timeout.
- Never lose a successful charge: if the processor took the money, our records must show it.
- Money records are append-only and auditable.
- The checkout call returns in under 2 seconds at p95, though the processor sometimes takes 30.
- 5 million paying customers.
- 3 million charges on the first of the month, most within a few hours; 200,000 on an average day.
- Webhooks arrive at up to 1,000 per second, sometimes out of order and sometimes more than once.
Tax calculation, invoicing PDFs, and fraud scoring.
Loading editor...
Submit your design to grade it.
- The components and connections this prompt needs
- Structure: an entry point, data stores, async work, and failure handling
- The concepts you explain on the board or in Notes, in your own words
To pass, score 65 or more with every required component but one, and name at least half the concepts, or all of them if a component is missing.