Mock Interviewer

Ask Coach

Ask Coach
Clarify requirements before you design — kept separate from your stage notes.

Tap a question to start, or type your own below.

Payment Gateway System Design

Visual Problem Diagram

Payment Gateway System Design architecture diagram

Scenario

You tap Pay once on a $2,400 order and expect a single charge. The painful failure is two charges on the card, because the second tap was treated as a new payment while the first one was still finishing.

Stuck on where to start? Ask Coach

Clarify this problem here, or open Pathway Coach if you want a prep plan first.

Free Coach trial
How should I start prep?

You pay a merchant with a card or a wallet. The merchant reserves the money first. They can take it later. They can also send it back. The page can time out. You tap Pay again. You are still charged once. The merchant learns the result even if their site blinked. Your full card number is swapped for a stand-in before it is stored.

You need to explain how a second tap returns the first result instead of charging again. You need to explain how a payment moves from reserved, to taken, to refunded. You need to explain how the card number is swapped for that stand-in before anything is stored. You need to explain how the merchant is told the result, including when the first notice was missed. You need to explain how your books match the card network's end-of-day file. A deep fraud model can stay thin.

Constraints

Functional

Start a payment. Reserve the money. Take the money. Refund it. A repeated Pay for the same attempt does the work once. Tell the merchant what happened. Leave a place for a fraud check.

Non-functional

The gateway stays up about 99.99 percent of the time. Most reserve calls finish in under 500 milliseconds, so the Pay button does not spin. The books for one account commit as a whole success or a whole failure. Card numbers are not stored.

Scale

Millions of merchants use the gateway. The hot action is Pay, peaking at about 10,000 payments a second. Billions of dollars move in a month. More than one currency is in use.

Stages ahead

1Requirement Analysis
2API Design
3High-Level Design
4HLD Extensions
5Trade-offs

Not ready to design yet?

Try the free Coach trial — ask how to prep, what to practice first, or how InterviewCrafted works. Sign in when you want to start this problem.

Try Coach free

Log in to start practicing

Preview the problem below. Sign in to start your timed session, save progress, and use the AI coach.

Want full access now? View Pro pricing