The interview prompt

“Design a system that identifies fraudulent payments before they are approved.”

The difficult part is deciding what to do with a prediction. Blocking every payment prevents fraud but also prevents the business from operating. A useful design balances fraud loss, legitimate customer friction, latency, and the capacity of human reviewers.

This is an illustrative interview scenario. Assume 1 million payment attempts per day, a 100 ms p95 budget for the risk decision, and a review team that can handle 500 cases per day. Those numbers are assumptions to clarify with an interviewer, not industry benchmarks.

01. Separate the score from the decision

Ask whether the system returns a risk score, recommends an action, or directly enforces a payment decision. For this design, return allow, challenge, review, or block, together with a decision ID and internal reason codes. The payment service remains responsible for completing the transaction.

Define fraud precisely. Confirmed unauthorized-payment reports are one possible label; disputes over product quality should not automatically count as the same event. Choose a label-maturity window from the observed reporting delay.

OutcomeHow to assess it
Fraud lossConfirmed loss per payment volume, measured on sufficiently mature cohorts.
Customer frictionChallenge rate, challenge completion, and estimated legitimate-payment rejection.
Review efficiencyConfirmed fraud found among reviewed cases and queue waiting time.
ReliabilityDecision latency, timeout rate, and fallback usage.

False declines are hard to observe: a blocked transaction never produces its ordinary payment outcome. State that limitation explicitly. A lower observed fraud rate can simply mean the system rejected more customers.

02. Start with rules and a measurable model

Establish a small rules baseline for clearly defined conditions, such as invalid input or excessive attempts. Give each rule an owner, a version, and an expiry or review process. Rules are useful emergency controls, but overlapping rules can create unexplained rejection spikes.

Use logistic regression or a gradient-boosted tree model as an initial supervised baseline over tabular features. Compare them on a time-based holdout at a fixed review or friction budget. Model complexity is secondary to label quality and feature availability.

Stripe's technical guide illustrates how machine learning and rules can coexist in fraud prevention. The architecture here is a teaching proposal, not a reconstruction of Stripe's system.

03. Build features that existed at decision time

Useful proposed features include payment amount, account age, recent attempt counts, recent successful payments, and differences from the account's established behavior. Prefer pseudonymous identifiers, scoped access, and explicit retention for sensitive payment-related data.

A five-minute attempt count must include only events known at the decision timestamp. An account's later fraud designation, eventual dispute status, or post-payment investigation result is not a valid serving feature.

Online risk decision
Payment requestFeature lookupRisk modelAction policy
Learning loop
Decisions + outcomesMature labelsTime-based training
Record feature and policy versions with the decision. Delayed outcomes update the training data after the payment attempt.

Keep fast rolling aggregates in an online feature store and durable events in a separate log. Use a stable payment-attempt ID so retries do not duplicate feature updates or review cases. Distinguish an event's occurrence time from the time the system learned about it.

Connected fundamental

Data leakage: when a model knows too much ↗

Point-in-time features, delayed labels, and trustworthy validation.

04. Evaluate under the real operating constraint

With an assumed fraud prevalence of 0.5%, predicting “legitimate” for every payment gives 99.5% accuracy. That baseline catches no fraud. Compare precision, recall, and financial impact at an explicit operating point.

For the 500-case review queue, examine how many confirmed fraud cases appear among the 500 selected cases on mature historical days. Also examine amounts at risk: catching ten small losses and missing one large loss may be the wrong trade-off.

Train on earlier data, tune the model and action thresholds on a later validation period, then assess the frozen policy on a final holdout with sufficiently mature labels. Exclude incomplete outcome windows or model censoring explicitly. Do not treat yesterday's unlabeled payments as clean negatives.

A score of 0.8 is not necessarily an 80% fraud probability. If the policy uses expected costs, assess calibration on a representative validation population, especially after class reweighting or negative sampling.

Connected fundamental

Class imbalance and decision thresholds ↗

Translate precision and recall into a review policy you can operate.

05. Design the policy and the failure path

Keep the action policy versioned separately from the model. A threshold change can be as consequential as a new model. Record the chosen action and policy version so a customer complaint or release regression can be traced.

  • Capacity: review admission must respect queue size and waiting-time limits. A fixed threshold does not guarantee 500 cases each day.
  • Retries: define whether a repeated decision request returns the prior decision or triggers reassessment under a new attempt ID.
  • Missing features: use trained missing-value behavior or a documented conservative fallback; monitor the frequency.
  • Timeouts: select a fallback by payment context and risk. Neither “allow everything” nor “block everything” is a universal answer.

Deploy in shadow mode to compare scores and latency without changing actions, then use a controlled rollout with pre-agreed guardrails. Shadow mode cannot reveal the outcomes of alternative decisions that were never taken. Monitor feature freshness, score distributions, rule activations, queue pressure, and mature fraud outcomes.

06. Work through the hard follow-ups

“Fraud patterns change before labels arrive.”

Track leading indicators such as unusual attempt velocity and challenge failures, while acknowledging that they are proxies. Use temporary, reviewed rules when justified. Evaluate the change again when labels mature; do not silently promote a proxy into ground truth.

“The old model blocked the riskiest payments.”

The training population is selected by the old policy. Offline replay cannot tell you all counterfactual outcomes. Explain where additional review, carefully bounded experiments, or assumptions are needed before estimating the effect of a new policy.

“Review volume doubles overnight.”

Check for an input change, attack, score calibration issue, or policy release before raising the threshold. Enforce the queue's admission policy, preserve urgent cases, and track the consequences of any temporary fallback.

Common mistakes

Optimizing accuracy, training on immature labels, using future investigation features, setting every cutoff to 0.5, or treating a ranking metric as a complete business decision.

Your answer in one minute

“I would define the loss and friction trade-off, establish rules and a tabular baseline, and build time-correct features. I would evaluate on mature temporal holdouts and select action thresholds under review capacity and cost constraints. Serving would have versioned policies, idempotent decision requests, explicit fallbacks, and a feedback loop that accounts for delayed and selectively observed labels.”

Calculate review workload before selecting a threshold

Additional original practice exercise · October 3, 2026. Numbers are illustrative assumptions.

Under the illustrative one-million-attempts/day workload, a policy sending 0.1% of attempts to review creates 1,000 cases/day. A team completing 500/day accumulates 500 cases/day if all cases enter the queue. Starting empty, after three days the backlog is 1,500 cases. Even if new admissions then stop, clearing it takes three days at the same service rate.

A 500-case/day capacity corresponds to just 0.05% of attempts. A fixed model threshold does not hold that rate constant when the population shifts. Use explicit admission capacity and urgency rules, and specify the action for cases that cannot wait. Ranking by fraud probability alone also ignores loss size and the benefit a reviewer can actually deliver.

Practice: halve review admissions while fraud losses rise. Distinguish model degradation from a capacity-policy change using saved decision versions and mature cohorts. Report friction and unreviewed exposure alongside queue length.

Related practice: Choose pointwise, pairwise or listwise ranking losses · Design a search ranking system

Sources & further reading

All volumes, budgets, and proposed policies in this walkthrough are illustrative.

Continue your preparation

Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.