Checkout for an online course store
Your task
Design checkout for a small company that sells video courses for a one-time price. A buyer clicks buy, pays on a hosted payment page from a card payment provider, and should get access to the course as soon as the payment succeeds. About 2,000 purchases happen on a normal day and 20,000 during a yearly sale. Buyers double-click, refresh and close the tab mid-payment; the provider can send the same webhook more than once, or late; and the store must never charge someone twice for one purchase or leave a paying buyer without access. Describe the order states, the API, and how payment and access stay consistent.
It covers
- Idempotency
- Payment webhooks
- Order state machine