Payment Infrastructure

Multi-tenant | Multi-PSP | Cascading | Adapter Pattern

Prototype
Infrastructure
EN
1.

Architecture Overview

1
FRONTEND LAYER
2
API GATEWAY
Auth & Brand
Phase 1

JWT + Brand context

Rate Limiting
Phase 2

Velocity checks

Request Router
Phase 2

Deposit | Withdrawal routes

3
ORCHESTRATION LAYER
Payment Orchestrator
Phase 2

Routing rules engine

Cascade Manager
Phase 2

Failover PSP1 → PSP2 → PSP3

State Machine
Phase 1

INITIATED → PROCESSING → DONE

Personalization
Phase 5

BIN + preferred method

Limits & Rules
Phase 3

Min/max, velocity, KYC gate

4
ADAPTER LAYER -- IPaymentProvider
5
EXTERNAL PSPs
PSP #1 API
Phase 1

Cards | Crypto

PSP #2 API
Phase 5

e-Wallets

PSP #N API
Phase 5

Local methods

6
SUPPORT SERVICES
Wallet Engine
Phase 2

Balance | ledger

KYC | AML
Phase 3

Verification gates

Bonus Engine
Phase 3

Wager | locks

Reconciliation
Phase 2

Nightly PSP sync

2.

Key Flows & Reference

DEPOSIT FLOW

01Player → Checkout UI
02 → API Gateway (auth + brand)
03 → Orchestrator (routing rules)
04 → Cascade Manager (PSP select)
05 → Adapter Layer (normalize)
06 → PSP API (execute)
07← Webhook → State Machine
08← Balance update → Wallet

TRANSACTION STATES

INITIATED
PROCESSING
PENDING_CONFIRMATION
COMPLETED
FAILED
TIMED_OUT → reconciliation
CANCELLED

ROUTING DIMENSIONS

Brandbrand_id → PSP config
GEOcountry → methods + PSP
Currencycurrency → PSP filter
Directiondeposit vs withdrawal
PlayerBIN + last success
Cascadepriority + health score
4.

Delivery Phases

0
Architecture & Contracts

Documents only -- no code

Output:FigJam with diagrams + Notion with contracts. All three parties have signed off.
1
Adapter Layer + First PSP

Backend only -- frontend not needed yet

Output:Deposit via PSP #1 is working. Adapter tests in place.
2
Orchestration Layer

Backend continues, frontend starts in parallel

Output:Working end-to-end deposit flow with one PSP and basic routing.
3
Withdrawal + Compliance
Output:Full payment cycle: deposit → play → withdraw.
4
Admin Panel
Output:Operations team can manage PSPs and routing without engineer involvement.
5
Personalization + Second PSP
Output:Checkout conversion improves. Second PSP connected with zero interface changes.
6
Advanced Routing + Risk
Output:Self-optimizing routing. Full risk and analytics layer.
DEPO44 | PAYMENT MODULE v1 | PHASE 0 ARCHITECTURE