Happy Independence Day

Jai Hind!

Skip to content
Engineering 5 min read

Designing Zero-Downtime Payment Switches for 50,000 TPS Flash Sales

Architecting active-active multi-region switches, circuit breakers, and sub-second failover paths for high-concurrency e-commerce spikes.

PE

Paisape Engineering

Engineering · 12 August 2026

← Back to all posts
Hero Image

The Flash Sale Scale Problem

During festive flash sales and mega shopping events in India, e-commerce platforms experience payment traffic bursts jumping from 500 Transactions Per Second (TPS) to over 50,000 TPS in seconds. Under this pressure, single-gateway setups collapse due to bank host rate-limiting, database connection pool exhaustion, or downstream network congestion.

Active-Active Multi-Region Topology

To eliminate single points of failure, modern payment switches deploy active-active multi-region clusters across geographically separated datacenters:

  • Global Anycast Load Balancers: Distribute incoming payment API payloads based on latency and server health metrics across Region A and Region B.
  • Stateless Routing Engine: The core transaction switch holds zero transient state in RAM. State transitions are externalized to high-speed distributed Redis clusters with active-active cross-datacenter replication.
  • Circuit Breaker Pattern: When a bank PSP host exhibits elevated error rates or latency above 1200ms, circuit breakers instantly trips. Traffic is automatically rerouted to healthy secondary PSP hosts within 200 milliseconds.

Distributed Idempotency & State Consistency

The single greatest risk during automated failover is double-charging a customer. If a payment request to Bank Host A times out, the switch cannot naively retry on Bank Host B without guaranteeing strict idempotency.

Paisape’s payment switch uses distributed two-phase locking backed by atomic idempotency keys. Before executing any gateway retry, the switch queries the settlement ledger and confirms the status via out-of-band verification APIs, eliminating duplicate charges completely