How juspay/hyperswitch works
Hyperswitch is a modular payments infrastructure stack. Its principal workflow is a merchant or client initiating a payment through the router, which processes it and can route it to a configured payment processor; related product capabilities include payment methods and vaulting, intelligent routing, revenue recovery, and analytics. The tree and README establish these product areas, but most runtime implementation excerpts are absent, so uncertain internal links are dashed and left uncited rather than presented as verified calls.
Main entry points: payments Payment orchestration · routes.rs API routes · connectors Payment connectors · payments.rs Payment endpoints
Components 22
API and orchestration
- API routes
crates/router/src/routes.rs - App routes
crates/router/src/routes/app.rs - Payment endpoints
crates/router/src/routes/payments.rs
Payment processing
- Payment orchestration
crates/router/src/core/payments - Payment domain
crates/hyperswitch_domain_models/src/router_data.rs - Intelligent routing
crates/router/src/core/routing
Processors and storage
- Payment connectors
crates/hyperswitch_connectors/src/connectors - Connector template
connector-template/mod.rs - Storage interface
crates/router/src/types/storage.rs - Storage backend
crates/storage_impl/src/kv_router_store.rs - External processors
Payment capabilities
- Payment methods
crates/payment_methods/src/controller.rs - File storage
crates/external_services/src/file_storage.rs - Revenue recovery
crates/subscriptions/src/core/billing_processor_handler.rs - Offer endpoints
crates/router/src/routes/offer_engine.rs - Offer engine
crates/router/src/core/offer_engine.rs - Offer notifications
crates/router/src/core/offer_engine/notify.rs
Analytics and observability
- Analytics endpoints
crates/router/src/analytics.rs - Analytics queries
crates/analytics/src/query.rs - Analytics models
crates/api_models/src/analytics.rs - Structured logging
crates/router_env/src/logger/storage.rs
Other components
- Merchant client
Connections 20
- Merchant client → API routes: sends requests
- API routes → Payment endpoints: routes requests
crates/router/src/routes.rs - Payment endpoints → Payment orchestration: dispatches payments
- Payment orchestration → Payment domain: uses payment data
- Payment orchestration → Intelligent routing: selects route
- Intelligent routing → Payment connectors: dispatches payment
- Payment connectors → External processors: sends transactions
- Payment orchestration → Storage interface: persists payment
- Storage interface → Storage backend: uses backend
- Payment orchestration → Payment methods: uses payment methods
- Payment methods → File storage: stores credentials
- Payment orchestration → Revenue recovery: supports retries
- API routes → Offer endpoints: registers routes
crates/router/src/routes.rs - Offer endpoints → Offer engine: dispatches offer requests
crates/router/src/routes/offer_engine.rs - Offer engine → Offer notifications: schedules notifications
crates/router/src/core/offer_engine.rs - API routes → Analytics endpoints: registers analytics
crates/router/src/routes.rs - Analytics endpoints → Analytics queries: queries analytics
- Analytics queries → Analytics models: uses request models
- API routes → Structured logging: records request context
- Payment connectors → Connector template: follows connector pattern