Skip to content

KOURIA13/payment-decision-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payment Decision Engine

Intelligent routing, fraud scoring, and approval optimization for payment systems at scale.

Python Streamlit Status ML


Context

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?


Problem Statement

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.


Solution

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

Product Walkthrough

Decision Output

Each transaction is analyzed and routed based on risk signals, provider performance history, and contextual data (amount, geography, payment method).


Provider Performance Analysis

The engine compares multiple acquirers across dimensions (approval rate, latency, margin) and selects dynamically per transaction.


Simulation Controls

The Streamlit dashboard allows testing different traffic conditions, filters, and routing strategies interactively.


Business Impact (Simulation)

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.


How It Works

Decision Flow

Transaction received
       ↓
Risk & context evaluation
       ↓
Success probability predicted per provider
       ↓
Best provider selected
       ↓
Failure? → Fallback triggered
       ↓
Final decision returned

Smart Fallback — Example

Attempt 1  →  acquirer_c  →  FAILED
Attempt 2  →  acquirer_a  →  APPROVED

Failed payments are recovered automatically without user intervention.

Provider Strategy

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.


Features

  • 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)

Getting Started

# 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

Tech Stack

Layer Tools
Language Python 3.10+
Data pandas, numpy
ML scikit-learn, LightGBM (optional), SHAP (optional)
Dashboard Streamlit
Visualization Matplotlib

Product Thinking

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

Disclaimer

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.

About

AI-powered payment decision engine optimizing approval rates with smart routing, fallback logic and business impact simulation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages