Intelligent routing, fraud scoring, and approval optimization for payment systems at scale.
In large-scale payment systems, every failed transaction has a direct business impact — lost revenue, degraded customer experience, and increased operational cost. Yet most systems still rely on static routing rules.
This project explores a different approach: what if payment routing decisions were dynamic, data-driven, and optimized in real time?
A payment can fail for multiple reasons: issuer rejection, fraud suspicion, provider instability, or latency constraints. At scale, even a marginal improvement in approval rate can represent millions in recovered revenue.
The challenge is to build a system that makes smarter routing decisions — in real time, at transaction level, with full business explainability.
The Payment Decision Engine simulates an AI-powered decisioning layer that:
- selects the optimal provider for each transaction based on risk and context
- predicts success probability per provider
- triggers fallback strategies on failure
- surfaces business KPIs (approval rate, margin, latency) in real time
Each transaction is analyzed and routed based on risk signals, provider performance history, and contextual data (amount, geography, payment method).
The engine compares multiple acquirers across dimensions (approval rate, latency, margin) and selects dynamically per transaction.
The Streamlit dashboard allows testing different traffic conditions, filters, and routing strategies interactively.
| Metric | Value |
|---|---|
| Approval Rate | 97.5% |
| Fallback Recovery | +5% transactions recovered |
| Avg Decision Latency | ~460 ms |
| Simulated Gross Margin | €111+ |
Smarter routing translates directly into measurable revenue recovery.
Transaction received
↓
Risk & context evaluation
↓
Success probability predicted per provider
↓
Best provider selected
↓
Failure? → Fallback triggered
↓
Final decision returned
Attempt 1 → acquirer_c → FAILED
Attempt 2 → acquirer_a → APPROVED
Failed payments are recovered automatically without user intervention.
| Provider | Strength |
|---|---|
acquirer_a |
High approval rate |
acquirer_b |
Balanced performance |
acquirer_c |
Low latency |
The engine arbitrates dynamically based on transaction context, not static rules.
- Intelligent multi-provider routing engine
- Fallback and retry logic with provider memory
- Fraud score integration and risk banding
- Business KPI simulation (margin, latency, approval rate)
- Latency-aware decisions
- Extensible ML scoring layer (LightGBM / XGBoost ready)
# 1. Generate synthetic data
python src/data_generator.py
# 2. Train the scoring model
python src/model.py
# 3. Run the decision engine
python main.py
# 4. Launch the dashboard
streamlit run app/streamlit_app.py| Layer | Tools |
|---|---|
| Language | Python 3.10+ |
| Data | pandas, numpy |
| ML | scikit-learn, LightGBM (optional), SHAP (optional) |
| Dashboard | Streamlit |
| Visualization | Matplotlib |
This project reflects a product + engineering mindset applied to a real payment operations problem:
- translating business constraints into a decision system
- balancing trade-offs between risk, cost, and performance
- building logic that is explainable, auditable, and extensible
- using simulation to validate hypotheses before production
This project uses synthetic data and is designed for demonstration and portfolio purposes only. It does not represent any production system or real transaction data.
Built to demonstrate applied product thinking in payment systems — routing optimization, fraud decisioning, and business KPI modeling.



