Skip to content

Razorpay

Provider ID: razorpay

Razorpay is the go-to provider for India. It supports UPI, net banking, wallets, EMI, and international cards. Amounts are in paise (minor units), which Sanwo passes through without conversion.

Terminal window
npm i @sanwohq/razorpay
import { razorpay } from "@sanwohq/razorpay";
const provider = razorpay({ keyId: "rzp_test_xxxxxxxxxxxx" });

Test keys start with rzp_test_. Get yours from the Razorpay Dashboard.

Razorpay uses minor units (paise) natively. Sanwo passes values straight through.

You pass Razorpay receives Meaning
50000 50000 500.00 INR (paise)
100 100 1.00 INR

INR, USD, EUR, GBP, SGD, AED, MYR

IN

Razorpay is focused on the Indian market. Your Razorpay account must be a registered Indian business.

card, netbanking, wallet, upi, emi, bank_transfer

Pass these via sanwoProviderOptions on web/React, or as flat fields on Flutter and mobile SDKs.

Option Type Description
orderId string Razorpay order ID created via your server
notes object Key-value pairs (max 15 keys, 256 chars per value)
theme object Checkout theme colors
image string Logo URL displayed on the checkout
{
theme: {
color: "#3399cc",
backdrop_color: "#ffffff",
}
}
{
notes: {
order_id: "ORD_1234",
shipping_address: "123 Main St, Mumbai",
}
}

Notes appear in the Razorpay Dashboard alongside the payment and can be used for reconciliation.

Razorpay recommends creating an order on your server first, then passing the orderId to the client. This prevents amount tampering.

Server (Node.js):

const Razorpay = require("razorpay");
const instance = new Razorpay({
key_id: "rzp_test_xxxxxxxxxxxx",
key_secret: "your_secret",
});
const order = await instance.orders.create({
amount: 50000, // 500 INR in paise
currency: "INR",
receipt: "order_receipt_1",
});
// Send order.id to the client

Client:

const result = await checkout({
amount: 50000,
currency: "INR",
customer: { email: "customer@example.com" },
sanwoProviderOptions: {
orderId: "order_xxxxxxxxxxxx", // from your server
notes: {
order_id: "ORD_1234",
},
theme: {
color: "#F37254",
},
image: "https://example.com/logo.png",
},
});

No extra config needed. Razorpay shows UPI as an option by default for INR payments. If you want to restrict to UPI only, your Razorpay dashboard settings control available methods.

const result = await checkout({
amount: 50000,
currency: "INR",
customer: { email: "customer@example.com" },
sanwoProviderOptions: {
orderId: "order_xxxxxxxxxxxx",
},
});