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.
Installation
Section titled “Installation”npm i @sanwohq/razorpayflutter pub add sanwo_razorpayIn Xcode, go to File > Add Package Dependencies and add:
https://github.com/Sanwohq/iosSelect the SanwoRazorpay product.
Add JitPack to settings.gradle.kts:
dependencyResolutionManagement { repositories { maven { url = uri("https://jitpack.io") } }}Then add the dependency in build.gradle.kts:
implementation("com.github.Sanwohq.android:sanwo-razorpay:1.0.0")import { razorpay } from "@sanwohq/razorpay";
const provider = razorpay({ keyId: "rzp_test_xxxxxxxxxxxx" });Test keys start with rzp_test_. Get yours from the Razorpay Dashboard.
Amount handling
Section titled “Amount handling”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 |
Supported currencies
Section titled “Supported currencies”INR, USD, EUR, GBP, SGD, AED, MYR
Supported countries
Section titled “Supported countries”IN
Razorpay is focused on the Indian market. Your Razorpay account must be a registered Indian business.
Payment methods
Section titled “Payment methods”card, netbanking, wallet, upi, emi, bank_transfer
Provider-specific options
Section titled “Provider-specific options”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 config
Section titled “Theme config”{ 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.
Usage examples
Section titled “Usage examples”Server-side order flow
Section titled “Server-side order flow”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 clientClient:
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", },});final result = await sanwo.checkout( CheckoutOptions( amount: 50000, currency: 'INR', customer: Customer(email: 'customer@example.com'), orderId: 'order_xxxxxxxxxxxx', notes: {'order_id': 'ORD_1234'}, theme: RazorpayTheme(color: '#F37254'), image: 'https://example.com/logo.png', ),);UPI payment
Section titled “UPI payment”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", },});