Design Real-Time Fraud Scoring for Card-Not-Present Payments
Last updated: November 29, 2026
Quick Overview
Design an ML system that scores every card and UPI payment for fraud risk before authorisation, deciding to allow, step up, or block within tens of milliseconds. Cover features, labels, model training, serving and how risk teams tune thresholds.
Razorpay
November 29, 20260
0
0 solved
Design an ML system that scores every card and UPI payment for fraud risk before authorisation, deciding to allow, step up, or block within tens of milliseconds. Cover features, labels, model training, serving and how risk teams tune thresholds.
Razorpay carries chargeback risk for many small merchants and must also protect against merchants who are themselves fraudulent. The interviewer checks real-time feature engineering, delayed and biased labels from chargebacks, and the business trade-off between blocking good customers and losing money.
What the Interviewer Expects
- Clear decision points and latency budget
- Real-time velocity features from a streaming store, consistent with training
- Label strategy given chargeback delay and selection bias from blocked payments
- Model choice and calibration, thresholds by merchant segment
- Cost-weighted evaluation rather than accuracy
- Feedback loop, monitoring and drift
Key Topics to Cover
How to Approach This
- Start by mapping the business objective to a concrete ML objective and metric.
- Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
- Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
- Address the serving latency budget and whether batch or real-time inference is needed.
- Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
- Blocked payments never get labels. How do you avoid training a model that only knows what the old model allowed?
- How would you score a merchant at onboarding when it has no history?
- How do you explain a block decision to a merchant's support team?
- Fraudsters adapt within days. How fast can you retrain and ship?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice ML System Design ProblemsSample Answer
Requirements
Score at payment creation, p99 under 30 ms. Outputs: risk score, decision (allow, 3DS step-up where optional, block, manual review). Precision matters because false blocks hurt merchant success rates,...
High-Level Design
Online path: payment API calls a scoring service with the payment context; the service fetches features from Redis (velocity counters) and a key-value store (entity profiles), runs a gradient-boosted ...