Stripe 🏗️ Stripe processes hundreds of billions of dollars annually, handling millions of API requests per minute across 195+ countries. This document outlines the comprehensive architecture that enables Stripe to deliver reliable payment infrastructure with 99.999% uptime.
Server SDKs Ruby, Python, Node
Authentication API Keys, OAuth
Server SDKs Ruby, Python, Node
Authentication API Keys, OAuth
Stripe's core payment flow processes millions of transactions per minute.
Input Validation Card, Amount, Currency
Tokenization PCI Compliant
Radar ML Models Fraud Detection
Custom Rules Merchant Config
Card Network Visa, Mastercard
Issuing Bank Authorization
Auth Response Approved/Declined
Batch Processing Settlement Files
Input Validation Card, Amount, Currency
Tokenization PCI Compliant
Radar ML Models Fraud Detection
Custom Rules Merchant Config
Card Network Visa, Mastercard
Issuing Bank Authorization
Auth Response Approved/Declined
Batch Processing Settlement Files
Components:
PaymentIntent : Tracks payment lifecycle from creation to confirmation
Tokenization : PCI-DSS compliant card data handling
Radar : ML-powered fraud detection (prevents $25B+ in fraud annually)
Network Routing : Intelligent routing for optimal authorization rates
Key Features:
Idempotency for safe retries
Automatic card network selection
Dynamic 3D Secure authentication
Real-time fraud scoring
Handles complex recurring billing scenarios.
Webhook System Payment Service Billing Engine Stripe API Customer Webhook System Payment Service Billing Engine Stripe API Customer Recurring billing on schedule Create Subscription Initialize Subscription Calculate Proration Create Invoice Process Payment Payment Result Emit Events Notify Merchant Webhook System Payment Service Billing Engine Stripe API Customer Webhook System Payment Service Billing Engine Stripe API Customer Recurring billing on schedule Create Subscription Initialize Subscription Calculate Proration Create Invoice Process Payment Payment Result Emit Events Notify Merchant
Billing Features:
Proration : Automatic pro-rated charges for plan changes
Usage-based Billing : Metered billing support
Trials : Free trial period management
Dunning : Smart retry logic for failed payments
ML-powered fraud prevention system.
Device Fingerprint Browser, Mobile
Behavioral Signals Typing, Mouse
Transaction History Network Data
Real-time Features Velocity, Amount
Aggregate Features Card, Email, IP
Network Features Cross-merchant
Ensemble Model Multiple Algorithms
Custom Rules Merchant-specific
Action Decision Allow, Block, Review
Explanation Top Risk Factors
Device Fingerprint Browser, Mobile
Behavioral Signals Typing, Mouse
Transaction History Network Data
Real-time Features Velocity, Amount
Aggregate Features Card, Email, IP
Network Features Cross-merchant
Ensemble Model Multiple Algorithms
Custom Rules Merchant-specific
Action Decision Allow, Block, Review
Explanation Top Risk Factors
Radar Capabilities:
Network Effect : Learns from billions of transactions
Adaptive ML : Continuously updates with new fraud patterns
Custom Rules : Merchant-configurable rule engine
3D Secure Integration : Smart authentication triggers
Distributes funds to millions of connected accounts.
Available Balance Ready for Payout
Pending Balance Processing
Reserve Balance Risk Mitigation
Payout Schedule Daily, Weekly, Manual
Wire Transfer International
Local Rails SEPA, BACS, etc.
Available Balance Ready for Payout
Pending Balance Processing
Reserve Balance Risk Mitigation
Payout Schedule Daily, Weekly, Manual
Wire Transfer International
Local Rails SEPA, BACS, etc.
Sync Replica Zero Data Loss
Async Replica 1 Read Scaling
Sync Replica Zero Data Loss
Async Replica 1 Read Scaling
Database Practices:
Synchronous Replication : Zero data loss for transactions
Sharding by Merchant : Horizontal scalability
Connection Pooling : PgBouncer for efficient connections
Encryption : AES-256 at rest, TLS in transit
Rate Limit Counters API Throttling
Session Cache Dashboard Auth
Config Cache Feature Flags
Webhook Queue Event Delivery
Rate Limit Counters API Throttling
Session Cache Dashboard Auth
Config Cache Feature Flags
Webhook Queue Event Delivery
payments Partitioned by merchant
customers Partitioned by customer
webhooks Partitioned by endpoint
payments Partitioned by merchant
customers Partitioned by customer
webhooks Partitioned by endpoint
API Events Charges, Refunds
Ruby Processing Sorbet Types
Radar Real-time Fraud Scoring
Balance Updates Available Funds
Webhook Dispatch Event Delivery
API Events Charges, Refunds
Ruby Processing Sorbet Types
Radar Real-time Fraud Scoring
Balance Updates Available Funds
Webhook Dispatch Event Delivery
Durable Execution : Workflows survive process failures
Payout Workflows : Multi-step payout processing
Subscription Lifecycle : Complex billing state machines
Retry Policies : Configurable retry strategies
Token Bucket Burst Handling
Redis Counters Distributed State
Adaptive Limits Load-based
Exponential Backoff Client SDK
Token Bucket Burst Handling
Redis Counters Distributed State
Adaptive Limits Load-based
Exponential Backoff Client SDK
Database Idempotency Cache Stripe API Client Database Idempotency Cache Stripe API Client alt [Key Not Found] [Key Found] POST /v1/charges (Idempotency-Key: abc123) Check Key Process Request Result Store Result (24h TTL) Response Cached Result Cached Response Database Idempotency Cache Stripe API Client Database Idempotency Cache Stripe API Client alt [Key Not Found] [Key Found] POST /v1/charges (Idempotency-Key: abc123) Check Key Process Request Result Store Result (24h TTL) Response Cached Result Cached Response
Idempotency Features:
24-hour key validity : Safe retries within window
Atomic operations : Prevents duplicate charges
Response caching : Consistent responses for same key
Global DNS Latency Routing
Card Networks Direct Connect
Global DNS Latency Routing
Card Networks Direct Connect
Velocity Checks Pattern Detection
Manual Review High-risk Transactions
Tokenization No Raw Card Data
Hardware Security Modules Key Storage
Network Segmentation CDE Isolation
API Key Auth Secret + Publishable
OAuth 2.0 Connect Platform
Webhook Signatures HMAC Verification
TLS 1.3 Certificate Pinning
Encryption at Rest AES-256
Audit Logging Immutable Trail
Velocity Checks Pattern Detection
Manual Review High-risk Transactions
Tokenization No Raw Card Data
Hardware Security Modules Key Storage
Network Segmentation CDE Isolation
API Key Auth Secret + Publishable
OAuth 2.0 Connect Platform
Webhook Signatures HMAC Verification
TLS 1.3 Certificate Pinning
Encryption at Rest AES-256
Audit Logging Immutable Trail
Tokenization : Card data never touches merchant servers
HSM-backed encryption : Hardware security for keys
Annual audits : Third-party security assessments
Penetration testing : Regular security testing
Secret keys : Server-side only, never exposed
Publishable keys : Client-side, limited scope
Restricted keys : Granular permission control
Webhook verification : HMAC signature validation
Prometheus Metrics Service Health
Distributed Traces Request Flow
Structured Logs JSON Format
Time Series DB Metrics Storage
Anomaly Detection ML-based
SLO Monitoring Error Budgets
Runbooks Automated Response
Prometheus Metrics Service Health
Distributed Traces Request Flow
Structured Logs JSON Format
Time Series DB Metrics Storage
Anomaly Detection ML-based
SLO Monitoring Error Budgets
Runbooks Automated Response
API Latency : p50, p95, p99 response times
Error Rates : 4xx, 5xx by endpoint
Payment Success Rate : Authorization rate by network
Webhook Delivery : Success rate and latency
main feature-branch Feature Dev Code Changes Type Check (Sorbet) Integration Tests Build Container Canary Deploy Production Deploy main feature-branch Feature Dev Code Changes Type Check (Sorbet) Integration Tests Build Container Canary Deploy Production Deploy
Sorbet Type Check Ruby Types
Security Scan Vulnerability Check
Observe Metrics 15 minutes
Sorbet Type Check Ruby Types
Security Scan Vulnerability Check
Observe Metrics 15 minutes
Kubernetes : Container orchestration
Sorbet : Gradual typing for Ruby
Temporal : Workflow orchestration
Terraform : Infrastructure as code
Network Partition Cross-region Failure
Service Failure Dependency Outage
Database Failover Primary Failure
System Metrics Latency, Errors
Network Partition Cross-region Failure
Service Failure Dependency Outage
Database Failover Primary Failure
System Metrics Latency, Errors
Chaos Practices:
GameDay Exercises : Quarterly disaster recovery drills
Dependency Failures : Simulated network/bank outages
Database Failovers : Automated primary promotion
Load Testing : 10x traffic simulation
Transaction Events Charges, Refunds
Merchant Events Onboarding, Updates
Fraud Events Disputes, Chargebacks
Apache Kafka Event Streaming
Apache Spark ETL Processing
Data Warehouse Presto/Trino
Radar Models Fraud Detection
Smart Routing Auth Optimization
Transaction Events Charges, Refunds
Merchant Events Onboarding, Updates
Fraud Events Disputes, Chargebacks
Apache Kafka Event Streaming
Apache Spark ETL Processing
Data Warehouse Presto/Trino
Radar Models Fraud Detection
Smart Routing Auth Optimization
Fraud Detection (Radar) : Real-time transaction scoring
Authorization Optimization : Network routing for success rate
Risk Assessment : Merchant and account risk scoring
Revenue Recovery : Smart retry timing for failed payments
Anomaly Detection : System health and abuse detection
35% 25% 20% 15% 5% Stripe Infrastructure Cost Distribution Compute & API Data Storage Network & Security ML Infrastructure Operations 35% 25% 20% 15% 5% Stripe Infrastructure Cost Distribution Compute & API Data Storage Network & Security ML Infrastructure Operations
Tiered Storage Hot/Cold Data
Archive Compliance Data 7+ Years
Deduplication Logs, Backups
Direct Peering Card Networks
Auto-scaling Traffic Patterns
Reserved Capacity Baseline Load
Spot Instances ML Training
Smart Routing Cost-effective Networks
Batch Processing Off-peak Hours
Aggressive Caching Reduce DB Load
Tiered Storage Hot/Cold Data
Archive Compliance Data 7+ Years
Deduplication Logs, Backups
Direct Peering Card Networks
Auto-scaling Traffic Patterns
Reserved Capacity Baseline Load
Spot Instances ML Training
Smart Routing Cost-effective Networks
Batch Processing Off-peak Hours
Aggressive Caching Reduce DB Load
Interchange Optimization : Intelligent card network routing
Reserved Capacity : Predictable baseline costs
Data Lifecycle : Automated archival for compliance data
ML Efficiency : Model optimization for inference cost
Real-time Payments : FedNow, RTP network integration
Cryptocurrency : Stablecoin and crypto payment support
Embedded Finance : Banking-as-a-Service expansion
AI/ML : Enhanced fraud detection and routing
Global Expansion : New payment methods and currencies
Vertical Solutions : Industry-specific payment products
Developer Experience : Enhanced APIs and tools
Compliance Automation : RegTech integration
Edge Computing : Reduced latency for global merchants
Green Computing : Carbon-neutral infrastructure
Zero-Trust Security : Enhanced security posture
Multi-Cloud : Resilience through cloud diversity
Stripe's architecture demonstrates how to build financial infrastructure at scale while maintaining the highest standards of security, reliability, and developer experience. The combination of robust payment processing, ML-powered fraud detection, and global reach enables millions of businesses to accept payments worldwide.
The platform continues to evolve with new payment methods, enhanced fraud prevention, and expanded financial services, all while maintaining the API simplicity and reliability that developers depend on.
There might be iterations needed, current data is as close I could get.