Scenario
Design a backend payment system for an online product that supports:
-
One-time charges and refunds.
-
Idempotent payment APIs (clients may retry).
-
Asynchronous interaction with external payment processors (e.g., card networks via a payment gateway).
-
Accurate accounting/ledger and reporting.
What to cover
-
Core APIs and data model.
-
Handling retries, duplicates, and failures.
-
Ensuring correctness (no double charge; consistent ledger).
-
Observability and reconciliation.
You can make reasonable assumptions and state them explicitly.