← Back to all spotlights

Juspay Hyperswitch: Open-Source Rust Payment Orchestration

Ditch payment gateway lock-in with Hyperswitch, an open-source, blazingly fast payment switch written in Rust for intelligent routing and cascading fallbacks.

P24
By Pickwise24 Editorial Team
Verified Open-Source Review

There are few events capable of giving an engineering lead spontaneous heart palpitations quite like a payment processor outage on a Friday afternoon. One moment transactions are gliding through, and the next, your primary gateway decides to return cryptic 500 errors while your checkout page burns.

Historically, escaping single-vendor lock-in meant writing brittle, home-brewed abstraction layers. Maintaining bespoke API integrations across Stripe, Adyen, PayPal, and regional providers quickly turns into an unmaintainable swamp of webhook synchronisation and edge-case reconciliation.

Enter juspay/hyperswitch, an open-source, financial-grade payments switch written entirely in Rust. Hyperswitch acts as a smart proxy layer between your client applications and dozens of downstream payment processors, handling intelligent routing, cascading retries, and unified tokenisation without breaking a sweat.


What is Hyperswitch?

Hyperswitch is a distributed, high-performance payment orchestration engine developed by Juspay. It unifies dozens of disparate payment processors behind a single, Stripe-compatible API specification.

By running as an intermediary service in your infrastructure, Hyperswitch decouples payment collection logic from merchant business logic, offering native support for:

  • Dynamic smart routing based on success rates, fees, or geography.
  • Zero-downtime processor failover and cascading retries.
  • PCI-DSS compliant vaulting and card tokenisation.
  • Unified analytics, dispute workflows, and refund handling.

[ Client App / Frontend ]
          │
          ▼  (Unified API / SDK)
┌──────────────────────────────────────────────┐
│            Hyperswitch Router (Rust)         │
│  ┌───────────────┐      ┌─────────────────┐  │
│  │ Smart Routing │ ───► │ Session Vault   │  │
│  └───────┬───────┘      └─────────────────┘  │
└──────────┼───────────────────────┼───────────┘
           │                       │
      (Primary Route)      (Fallback / Split)
           ▼                       ▼
    [ Stripe Engine ]       [ Adyen Gateway ]

Under the Hood: The Rust Architecture

Building financial rails in interpreted languages or garbage-collected runtimes like Node.js or Java often incurs unwanted latency spikes and memory overheads. Hyperswitch was engineered in Rust to enforce strict memory safety guarantees while delivering predictable, microsecond-level response times.

  1. Async Runtime: Built on actix-web and tokio, Hyperswitch handles massive concurrent request spikes during flash sales without thread starvation.
  2. Modular Connectors: Every payment gateway is implemented as an isolated connector crate implementing strict domain-specific traits (e.g., PaymentAuthorize, PaymentSync, PaymentCapture). Adding a new payment partner doesn't risk corrupting existing gateway logic.
  3. Storage Decoupling: Hyperswitch uses PostgreSQL for durable ledger records and transaction state, paired with Redis for low-latency session caching and distributed rate-limiting.
  4. Data Isolation (Locker): Sensitive cardholder data can be offloaded to an isolated tokenisation vault service (Hyperswitch Card Vault), shrinking the PCI-DSS compliance scope for the rest of your application stack.

Architecture & Feature Comparison

CapabilityDirect Gateway SDKsProprietary OrchestratorsJuspay Hyperswitch
Vendor IndependenceNone (Single provider lock-in)Partial (Closed ecosystem)Complete (Self-hostable, Open Source)
Runtime LanguageLanguage specificClosed Source / Go / JavaRust (High throughput, zero GC pauses)
Failover CascadingManual application logicAutomatedConfigurable via DSL rules
API SurfaceFragmented per vendorUnified proprietary APIUnified Stripe-compatible spec
Data CustodyGateway retains card dataThird-party cloud vaultSelf-hosted encrypted vault

Getting Started: Local Setup with Docker

The fastest route to spin up Hyperswitch locally for evaluation is using Docker Compose. The repository includes pre-baked manifests spinning up the core engine, a PostgreSQL instance, and a Redis broker.


# Clone the repository
git clone https://github.com/juspay/hyperswitch.git
cd hyperswitch

# Copy the example environment variables
cp crates/router/config/config.example.toml crates/router/config/config.toml

# Start the full stack using the local compose target
docker compose -f docker-compose.yml up -d

Once the containers initialise, the Hyperswitch service will listen on http://localhost:8080.

Verify system health:


curl --location --request GET 'http://localhost:8080/health'

A healthy node responds with a simple:


{
  "status": "Healthy"
}

Initialising a Payment Intent

Hyperswitch purposefully mirrors modern payment conventions, which means if you have ever touched the Stripe API, integrating with Hyperswitch feels immediately intuitive.

Here is how you initialise a payment session against the Hyperswitch router:


curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_admin_secret_key' \
--data '{
    "amount": 4999,
    "currency": "GBP",
    "customer_id": "cust_pickwise_01",
    "payment_method": "card",
    "capture_method": "automatic",
    "return_url": "https://example.com/checkout/complete"
}'

In response, Hyperswitch provisions an orchestrator session ID, runs your configured routing rules (for instance: if currency == GBP, attempt downstream processor B first; if unresponsive within 800ms, fall back to processor A), and provides client secret tokens for frontend payment elements.


Writing Routing Rules

One of the standout design decisions in Hyperswitch is its domain-specific routing configuration. Instead of hard-coding provider distribution ratios inside your business codebase, routing logic is configured dynamically through JSON/YAML condition matrices via the Admin API.

For example, a routing policy can split volume algorithmically:


{
  "name": "Cost_and_Region_Optimised",
  "algorithm": {
    "type": "priority",
    "data": [
      {
        "connector": "stripe",
        "condition": "currency == GBP"
      },
      {
        "connector": "adyen",
        "condition": "currency == EUR"
      }
    ]
  },
  "fallbacks": [
    {
      "connector": "checkout",
      "condition": "error_code in ['network_timeout', 'processor_unavailable']"
    }
  ]
}

If the primary route fails due to an upstream provider timeout, Hyperswitch catches the error, wraps the transaction securely, and executes a cascading attempt against the fallback target without forcing the user to re-enter their CVV or re-trigger the checkout button.


Why Hyperswitch Stands Out

The payment routing landscape has traditionally been dominated by closed SaaS aggregators that charge hefty basis-point platform taxes on top of standard processing costs. Hyperswitch changes that model entirely.

By providing an Apache-2.0 licensed, modular switch engineered in Rust, it solves the dual challenge of regulatory compliance and infrastructural independence. Whether you want to route local UK card schemes through regional providers or ensure mission-critical resilience across global nodes, Hyperswitch offers a modern, battle-hardened foundation for payment engineering.

🛡️ Editorial Standards & Methodology

Every repository featured on Pickwise24 undergoes testing on local workstation hardware before publication. We verify CLI installation steps, review open-source repository licensing, benchmark computational footprint, and evaluate architectural trade-offs to provide genuine, high-utility developer intelligence.