CHAPTER 4
Payment Systems & Infrastructure
Technical architecture, transaction processing, settlement mechanisms, and the infrastructure powering digital currency payment systems.
4.1 Digital Payment Architecture
Modern digital currency payment systems require sophisticated infrastructure to process millions of transactions securely, quickly, and reliably. Understanding this architecture is essential for implementing WIA-FIN-004 compliant systems.
4.1.1 Core Components
A complete digital currency payment system consists of several key components:
- User Layer: Digital wallets, mobile apps, web interfaces for end users
- Application Layer: Payment processing logic, transaction orchestration, business rules
- Service Layer: APIs, authentication, authorization, rate limiting
- Settlement Layer: Ledger management, balance tracking, transaction finality
- Compliance Layer: KYC/AML screening, transaction monitoring, reporting
- Security Layer: Cryptographic operations, key management, fraud detection
- Infrastructure Layer: Databases, caching, message queues, cloud services
4.1.2 Transaction Flow
A typical digital currency payment follows this flow:
- Initiation: User initiates payment through wallet or application
- Authentication: User identity and authorization verified (biometrics, PIN, 2FA)
- Validation: Transaction details validated (sufficient balance, valid recipient, amount limits)
- Compliance Check: AML/KYC screening, sanctions checking, velocity limits
- Authorization: Transaction authorized and signed cryptographically
- Routing: Transaction routed to appropriate settlement network
- Settlement: Balances updated, transaction recorded on ledger
- Confirmation: Both parties notified of successful transaction
- Reconciliation: Transaction reconciled with reserves/accounting systems
4.2 Settlement Mechanisms
4.2.1 Real-Time Gross Settlement (RTGS)
RTGS systems settle transactions individually and immediately, providing instant finality. Each transaction is processed independently without netting.
Characteristics:
- Immediate settlement (no delay)
- Gross settlement (transaction-by-transaction)
- Irrevocable once settled
- Typically used for high-value payments
- Requires sufficient liquidity at all times
Digital Currency Implementation:
- Bitcoin and most cryptocurrencies use RTGS model
- CBDC systems often implement RTGS for transparency
- Blockchain-based systems inherently provide RTGS
4.2.2 Deferred Net Settlement (DNS)
DNS systems accumulate transactions throughout the day and settle net positions at specific times (e.g., end of day). This reduces liquidity requirements but introduces settlement risk.
Characteristics:
- Batch processing at intervals
- Net settlement (only net position transferred)
- Lower liquidity requirements
- Settlement risk until batch clears
- Used for high-volume, lower-value retail payments
4.2.3 Atomic Settlement
Atomic settlement ensures that either all parts of a transaction complete or none do—critical for complex operations like currency exchanges or multi-party payments.
Use Cases:
- Cross-currency exchanges (delivery vs. payment)
- Securities settlement (atomic swap of cash and securities)
- Multi-party escrow transactions
- Smart contract-based conditional payments
// Example: Atomic swap using smart contract
contract AtomicSwap {
function swap(
address party1, uint256 amount1, address currency1,
address party2, uint256 amount2, address currency2
) public {
require(balanceOf(party1, currency1) >= amount1);
require(balanceOf(party2, currency2) >= amount2);
// Atomic transfer - both happen or neither
transfer(party1, party2, amount1, currency1);
transfer(party2, party1, amount2, currency2);
}
}
4.3 Cross-Border Payment Systems
4.3.1 Traditional Correspondent Banking
Traditional cross-border payments rely on correspondent banking networks, where banks maintain accounts with each other to facilitate international transfers.
Problems:
- Slow: 3-5 business days typical
- Expensive: 6-7% average fees for remittances
- Opaque: Difficult to track payment status
- Complex: Multiple intermediaries, currency conversions
- Limited hours: Only during banking hours
4.3.2 Digital Currency Solutions
Digital currencies can revolutionize cross-border payments:
Direct Blockchain Transfers
- Sender converts fiat → cryptocurrency → sends → recipient converts → fiat
- Fast: Minutes instead of days
- Cheap: Fraction of traditional costs
- 24/7 availability
- Challenge: Volatility during transfer time
Stablecoin Corridors
- Use stablecoins to eliminate volatility
- Example: USD → USDC → transfer → USDC → local currency
- Companies like Circle, Ripple building corridors
- Instant settlement, low fees
CBDC Bridges
- Direct central bank to central bank transfers
- mBridge project: China, Hong Kong, Thailand, UAE
- Eliminates intermediaries entirely
- Instant settlement with full regulatory oversight
4.4 Payment Network Protocols
4.4.1 Lightning Network (Bitcoin Layer 2)
Lightning Network enables instant, high-volume Bitcoin micropayments through off-chain payment channels.
How it works:
- Two parties open a payment channel by locking Bitcoin in a multi-sig address
- They can transact unlimited times off-chain, updating channel balance
- Only opening and closing transactions are recorded on Bitcoin blockchain
- Payments can be routed through multiple channels
Benefits:
- Instant transactions (milliseconds)
- Massive scalability (millions of TPS theoretically)
- Tiny fees (fractions of a cent)
- Enables true micropayments
4.4.2 Raiden Network (Ethereum Layer 2)
Similar to Lightning but for Ethereum and ERC-20 tokens, enabling fast, cheap token transfers.
4.4.3 Interledger Protocol (ILP)
Protocol for connecting different payment networks and ledgers, enabling seamless value transfer across systems.
Key concepts:
- Connectors route payments across networks
- Atomic mode ensures secure transfers
- Universal addressing for any ledger
- Supports any currency or asset type
4.5 API Standards (WIA-FIN-004 Phase 2)
4.5.1 Payment Initiation API
POST /api/v1/payments
Request:
{
"from": {
"type": "WALLET | ACCOUNT",
"identifier": "user@example.com",
"currency": "USD"
},
"to": {
"type": "WALLET | ACCOUNT",
"identifier": "merchant@example.com",
"currency": "USD"
},
"amount": {
"value": "100.00",
"currency": "USD"
},
"purpose": "Payment for services",
"idempotencyKey": "unique-key-12345",
"metadata": {
"orderId": "ORD-001",
"customerRef": "CUST-789"
}
}
Response:
{
"paymentId": "PAY-abc123",
"status": "PENDING | PROCESSING | COMPLETED | FAILED",
"createdAt": "2024-01-15T10:30:00Z",
"estimatedSettlement": "2024-01-15T10:30:05Z",
"fee": {
"amount": "0.50",
"currency": "USD"
}
}
4.5.2 Payment Status API
GET /api/v1/payments/{paymentId}
Response:
{
"paymentId": "PAY-abc123",
"status": "COMPLETED",
"timeline": [
{
"status": "INITIATED",
"timestamp": "2024-01-15T10:30:00Z"
},
{
"status": "COMPLIANCE_CHECK",
"timestamp": "2024-01-15T10:30:01Z"
},
{
"status": "SETTLED",
"timestamp": "2024-01-15T10:30:03Z"
},
{
"status": "COMPLETED",
"timestamp": "2024-01-15T10:30:05Z"
}
],
"transactionHash": "0x742d35Cc...",
"confirmations": 12
}
4.5.3 Balance Inquiry API
GET /api/v1/accounts/{accountId}/balance
Response:
{
"accountId": "ACC-12345",
"balances": [
{
"currency": "USD",
"available": "1000.00",
"pending": "50.00",
"total": "1050.00"
},
{
"currency": "USDC",
"available": "500.00",
"pending": "0.00",
"total": "500.00"
}
],
"lastUpdated": "2024-01-15T10:30:00Z"
}
4.6 Performance and Scalability
4.6.1 Transaction Throughput
Payment systems must handle varying transaction volumes:
| System |
TPS |
Latency |
| Visa Network |
65,000 TPS (peak capacity) |
~2 seconds |
| Bitcoin |
7 TPS |
10-60 minutes |
| Ethereum |
15-30 TPS |
15 seconds - 5 minutes |
| Solana |
2,000-3,000 TPS |
~1 second |
| Lightning Network |
1,000,000+ TPS |
< 1 second |
| CBDC (typical) |
10,000-100,000 TPS |
< 1 second |
4.6.2 Scaling Strategies
- Layer 2 Solutions: Lightning Network, Raiden, Polygon for off-chain scaling
- Sharding: Splitting ledger across multiple chains (Ethereum 2.0)
- State Channels: Off-chain computation with on-chain settlement
- Sidechains: Separate chains with cross-chain bridges
- Optimistic Rollups: Batch transactions with fraud proofs
- Zero-Knowledge Rollups: Batch transactions with validity proofs
- Database Optimization: Caching, indexing, read replicas for centralized systems
4.7 Security and Resilience
4.7.1 Redundancy and Availability
Critical payment infrastructure must maintain high availability:
- Geographic Distribution: Multiple data centers across regions
- Active-Active Setup: Load balancing across all instances
- Automatic Failover: Seamless switching if primary fails
- Database Replication: Real-time data sync across locations
- Disaster Recovery: Regular backups, tested recovery procedures
- Target: 99.99% uptime (less than 1 hour downtime per year)
4.7.2 DDoS Protection
- Rate limiting per user/IP
- CDN for static content and API caching
- Traffic analysis and anomaly detection
- Excess capacity for traffic spikes
4.7.3 Transaction Security
- Encryption: TLS 1.3 for all communications
- Authentication: Multi-factor, biometric, hardware keys
- Authorization: Fine-grained access control
- Signing: Cryptographic transaction signing
- Fraud Detection: Machine learning models for suspicious patterns
- Transaction Limits: Velocity checks, daily limits
4.8 Offline Payment Capabilities
Digital currencies should support offline transactions for resilience and inclusion in areas with poor connectivity.
4.8.1 NFC-Based Offline Payments
- Near Field Communication between devices
- Transactions stored locally, synchronized when online
- China's e-CNY implements this extensively
- Limits on offline transaction amounts and counts
4.8.2 SMS-Based Systems
- Simple text message commands for payments
- Works on basic phones without internet
- Used extensively in M-Pesa and similar systems
- Lower security but critical for inclusion
"The best payment system is invisible—fast, secure, and reliable enough that users never have to think about the underlying infrastructure." - WIA Payment Systems Guide