Backend system design · about 45 minutes
Payment system
Design the payment system of an online platform. The server of a merchant asks it to charge the card of a buyer, the system calls an outside card processor, and it records each move of money. A payment must occur exactly one time, also when a request arrives two times, a service stops in the middle, or the processor answers late.
Ask first
- Do we call a card processor, or are we the processor that talks to the card networks?
- How many payments a day, and how high is the peak? Which currencies and payment methods?
- Do we need refunds and payouts to merchants, or only the charge?
- Who holds the card data? Can hosted fields of the processor keep card numbers off our servers?
- How fast must the merchant get the result, and how do we send it: in the answer, as a webhook, or both?
The outline
Write your own outline for each part first.
The strong answer, the pitfalls and the follow-ups opens with a year in the app. What a year includes