---
title: "Deploy Hyperswitch Razorpay"
description: "Route Indian payments through Razorpay with Hyperswitch"
category: "Other"
url: https://railway.com/deploy/deploy-hyperswitch-with-razorpay
---

# Deploy Hyperswitch Razorpay

Route Indian payments through Razorpay with Hyperswitch

**[Deploy Hyperswitch Razorpay on Railway](https://railway.com/template/deploy-hyperswitch-with-razorpay)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-hyperswitch-with-razorpay/manifest.json

- **Creator:** onepush
- **Category:** Other

## Template content

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.10@sha256:47670742d7924adbcdb404d1288b6327815b23141969c0939b8e5d61f78c2634
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### control-center

- **Image:** juspaydotin/hyperswitch-control-center:v1.38.10@sha256:be7c128fb0e92a22d576c8ec15a8dffda047ceb5242ca1b4d48dc73d20498366
- **Health check:** /health
- **Public domain:** Yes

### hyperswitch-router

- **Image:** ghcr.io/onepush-dev/hyperswitch-router:v1.128.0@sha256:71110fad0a471321fc2b1f3794f40f08235b441e64cae4c01dea4904b38fcae4
- **Health check:** /health
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18@sha256:fcc6686a3f4f1962fe4ed77a15884553b7bd611ae1cea3204687968c5c09d517

## Documentation

# Deploy and Host self hosted Hyperswitch Razorpay (Self-Hosted Payment Connector Setup) on Railway

This template deploys Hyperswitch with its control center and router on Railway, so you can add Razorpay as a connector and send UPI Collect payments through your own orchestration layer.

## About Hosting Hyperswitch Razorpay open-source software on Railway (self hosted Razorpay connector for self-hosted Hyperswitch template)

This template runs the Hyperswitch stack in your own Railway project: the router API on public port 8080, the control-center dashboard on port 9000, plus Postgres 18 and Redis 8.2.

Railway handles containers, networking, TLS, volumes and database hosting, so you do not maintain a server.

## Why Deploy Hyperswitch Razorpay, the Razorpay direct alternative on Railway (Railway Free Trial)

Razorpay direct is simpler if you only need UPI Collect: integrate the API once and you're done.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Hyperswitch Razorpay on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for Hyperswitch Razorpay self hosting

Here is how the Hyperswitch Razorpay stack compares on Railway and on a general VPS.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Router, control center, Postgres and Redis deployed from one template, so you skip writing compose files and TLS setup. | Root access and predictable droplet pricing, but you install Docker, run the stack and handle backups yourself. |
| AWS | Four services in one project with no VPC or IAM setup, handy for testing Razorpay sandbox credentials. | Fine-grained networking and managed database options, with a steeper learning curve. |
| Hetzner | Public domains per service without touching a server. | Low-cost compute in Europe, with you owning the OS and reverse proxy. |

Choose Railway for a fast Razorpay connector test, and a VPS when you want full control.

## Common Use Cases for hosted Hyperswitch Razorpay

- **Adding Razorpay UPI Collect for INR checkouts:** Add Razorpay in the control center with the Razorpay Id and Razorpay Secret from your dashboard, and check that the connector shows INR and IND. Only UPI is listed, so plan checkout around UPI rather than cards.
- **Routing UPI through an orchestrator:** Razorpay sits alongside your other processors, so one POST /payments call can apply routing rules and fallbacks.
- **Testing a sandbox integration first:** Razorpay's status here is sandbox, so run the full flow with test credentials. The docs don't name a test-mode toggle, so confirm where it lives.
- **Reconciling pending UPI payments:** Status sync isn't sent to Razorpay for UPI Collect, so a payment can stay pending after approval. Check the Razorpay dashboard for the final state.
- **Tracking refund updates through webhooks:** Refund webhooks update refund status one sync later, while payment webhooks change nothing. Confirm amounts against Razorpay before acting.

## Dependencies for Hyperswitch Razorpay Docker hosted on Railway

Hyperswitch Razorpay needs the router and control center running against the same database before the Razorpay connector will work.

### Deployment Dependencies for Managed Hyperswitch Razorpay Service (Payment Orchestration)

The stack has four services: hyperswitch-router (ghcr.io/onepush-dev/hyperswitch-router:v1.128.0) on public port 8080, control-center (juspaydotin/hyperswitch-control-center:v1.38.10) on public port 9000, Postgres 18, and Redis 8.2.

### Implementation Details for Hyperswitch Razorpay (Using Hyperswitch official docker image)

The router mounts a volume at /local/bin/files. Keep ROUTER__SECRETS__ADMIN_API_KEY server side.

## How does Hyperswitch Razorpay compare against other ways to connect Razorpay to a payment orchestrator

### Hyperswitch Razorpay vs Razorpay direct (Direct Razorpay Integration Alternative)

- **Where Razorpay direct wins:** You integrate once against Razorpay's own API with no orchestration layer to run or debug.
- **Where Hyperswitch Razorpay fits:** One POST /payments interface sits in front of Razorpay, so adding or swapping a processor later doesn't mean rewriting checkout.
- **Trade-off to know:** The Hyperswitch connector is marked sandbox and lags Razorpay's own docs on some flows.

### Hyperswitch Razorpay vs Juspay (Hosted Juspay Orchestration Alternative)

- **Where Juspay wins:** Juspay built Hyperswitch and offers a hosted orchestration service with vendor support.
- **Where Hyperswitch Razorpay fits:** The code is Apache-2.0 and runs on your own servers, so orchestration data and keys stay in your infrastructure.
- **Trade-off to know:** Self hosting means you own uptime, upgrades and key backups.

### Hyperswitch Razorpay vs Cashfree (Cashfree Direct Integration Alternative)

- **Where Cashfree wins:** It covers collections and payouts from one provider through its own API.
- **Where Hyperswitch Razorpay fits:** You route UPI Collect through Razorpay alongside other processors under one API.
- **Trade-off to know:** Hyperswitch Razorpay only handles UPI Collect here, so Cashfree covers more methods out of the box.

### Hyperswitch Razorpay vs Stripe (Stripe Processor Alternative)

- **Where Stripe wins:** It is a mature platform with a polished dashboard and broad card and wallet acceptance that Razorpay on Hyperswitch doesn't match.
- **Where Hyperswitch Razorpay fits:** INR and UPI traffic stays in India through Razorpay, and you control routing rules yourself.
- **Trade-off to know:** Stripe is simpler to run, while this path makes you manage the router, Postgres, Redis and credential backups.

## How to use Hyperswitch Razorpay (the OSS payment orchestrator)?

Here is what to do on day one after the stack is up.

1. Open the control center on the public domain Railway gave the control-center service (port 9000).
2. Find the connector setup menu and add Razorpay. The exact menu path isn't in the verified upstream docs, so check the UI.
3. Enter the Razorpay Id and Razorpay Secret from your Razorpay dashboard API keys, pasted exactly.
4. Confirm the connector is set to INR with country IND.
5. Send a test UPI payment to your hyperswitch-router domain on port 8080 with your api-key header, then check the Razorpay dashboard if the status stays pending.

```bash
curl -X POST https://router.yourdomain.com/payments \
  -H "Content-Type: application/json" \
  -H "api-key: YOUR_MERCHANT_API_KEY" \
  -d '{"amount": 10000, "currency": "INR", "payment_method": "upi", "payment_method_type": "upi_collect", "payment_method_data": {"upi": {"upi_collect": {"vpa_id": "customer@upi"}}}, "confirm": true}'
```

## How to self host Hyperswitch Razorpay on other VPS Services (Hyperswitch self hosting guide)

You can run the same stack on any Linux VPS with Docker instead of Railway. These steps assume a fresh Ubuntu box.

### Clone the Repository

Pull the official Hyperswitch repo and move into it.

```bash
git clone https://github.com/juspay/hyperswitch
cd hyperswitch
```

### Install Dependencies

The stack runs as Docker containers, so you only need Docker and Docker Compose on the host.

```bash
sudo apt-get update && sudo apt-get install -y docker.io docker-compose-plugin
bash scripts/setup.sh
```

### Configure Environment Variables

Generate your keys before first boot and back them up. Losing MASTER_ENC_KEY makes stored Razorpay credentials unreadable.

```bash
export MASTER_ENC_KEY=$(openssl rand -hex 32)
export HASH_KEY=$(openssl rand -hex 32)
export ENCRYPTION_KEY=$(openssl rand -hex 32)
```

Keep ROUTER__SECRETS__ADMIN_API_KEY on the server side only.

### Start the Hyperswitch Razorpay Application

Bring the stack up detached, then confirm the router is healthy.

```bash
docker compose up -d
curl http://your-domain:8080/health
```

Railway handles containers, Postgres, Redis, TLS and domains for you, which is what you give up when you run it yourself.

## Official Pricing of Hyperswitch Razorpay (Hyperswitch pricing)

Hyperswitch is open source under Apache-2.0 and free to self host, so there is no license fee.

## Hyperswitch Razorpay cloud vs self hosted comparison (Pricing, features, costs, and more)

Self hosting puts the connector setup and the bill in your hands.

### Monthly cost of self hosting Hyperswitch Razorpay on Railway

Railway's usage-based billing for this four-service stack (the router, the control center, Postgres 18 and Redis 8.2) typically lands at about $15 to $30 per month at light use.

### System Requirements for Hosting Hyperswitch Razorpay on a VPS

On your own VPS, the router, control center, Postgres and Redis share the machine, so size it for your traffic rather than the minimum.

## Frequently Asked Questions (FAQs)

### Do cards work through Razorpay on Hyperswitch?

Not as far as the upstream docs go.

### Why does the payment status stay pending after UPI approval?

On the pinned code, status sync is never sent to Razorpay for UPI Collect, so the status does not move on its own after the customer approves.

### Is webhook signature verification supported?

No. Treat incoming webhooks as untrusted and confirm state with a sync or the Razorpay API.

### How do I test in sandbox mode?

The integration is marked sandbox, and the docs do not describe a test-mode toggle.

### What currency and countries are supported?

The Razorpay connector supports INR only, with country IND.

### Does Hyperswitch support refunds and void for Razorpay?

Refunds are supported, and refund webhooks update refund status one sync later. Void is not supported for Razorpay.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/deploy-hyperswitch-with-razorpay
