Build with BaseUPI
Everything you need to integrate seamless, commission-free UPI payments into your SaaS, app, or website.
Welcome
BaseUPI is a developer-first payment infrastructure that turns your Android phone into a payment gateway. No high commissions, no middle-man holding your funds. Money moves directly from your customer's UPI app to your bank account.
Native SDKs for Node.js and React for rapid development.
100% of the payment hits your bank account instantly.
Account Setup
Before writing code, you need a merchant account and a valid UPI ID.
Create Merchant Account
Sign up on our dashboard and complete your basic business profile.
Configure UPI ID
Add your VPA (e.g., merchant@upi) in Settings. This is your destination wallet.
Secure API Key
Obtain your API Key from the Developer tab to authenticate your requests.
Android Companion App
Critical for Reliability
The companion app must stay running in the background to detect bank SMS. Ensure Battery Optimization is set to "Unrestricted" and Bank SMS notifications have high priority.
1. Setup Device
- Disable Play Protect
- Grant SMS & Background permissions
- Scan Dashboard QR to link
Creating Orders (HTTP)
Initiate a payment session securely from your backend server using a standard HTTP request.
const response = await fetch("https://api.baseupi.com/api/v1/orders", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${process.env.BASEUPI_API_KEY}`
},
body: JSON.stringify({
amountPaise: 50000, // ₹500.00
merchantOrderId: "order_99",
redirectUrl: "https://mysaas.com/thank-you"
})
});
const data = await response.json();
console.log(data.checkoutUrl);Webhook Verification
Listen for payment webhooks. You must calculate the HMAC SHA256 hash using your secret to structurally prove authenticity.
// Example using Express.js
import crypto from "crypto";
import express from "express";
app.post('/api/webhooks', express.raw({ type: "application/json" }), (req, res) => {
const signature = req.headers['x-baseupi-signature'];
const timestamp = req.headers['x-baseupi-timestamp'];
const payloadToHash = `${timestamp}.${req.body.toString()}`;
const myComputedSignature = crypto
.createHmac("sha256", process.env.BASEUPI_WEBHOOK_SECRET)
.update(payloadToHash)
.digest("hex");
if (signature !== myComputedSignature) {
return res.status(401).send("Unauthorized Webhook!");
}
const event = JSON.parse(req.body.toString());
if (event.type === 'BASEUPI_PAYMENT_SUCCESS') {
// Fulfill order securely here!
}
res.status(200).send("OK");
});Node.js SDK (Optional)
If you prefer cleanly abstracted code, our official Node.js SDK securely handles HTTP requests and crypto logic automatically.
npm install @baseupi/node
import { BaseUPI, WebhookSignatureError } from '@baseupi/node';
const baseupi = new BaseUPI({ apiKey: process.env.BASEUPI_API_KEY });
// Creating an order securely
const order = await baseupi.orders.create({
amountPaise: 50000,
merchantOrderId: 'order_99'
});
// Inside your webhook route:
try {
const event = baseupi.webhooks.constructEvent({
payload: req.body,
signature: req.headers['x-baseupi-signature'],
timestamp: req.headers['x-baseupi-timestamp'],
secret: process.env.BASEUPI_WEBHOOK_SECRET
});
} catch(err) {
// Protects against Fake Webhook hackers automatically
}Vanilla Widget (Optional)
No framework? No problem. Use our global script to trigger a unified checkout modal without redirecting users.
<script src="https://baseupi.app/widget.js"></script>
BaseUPI.checkout({
checkoutToken: "tok_K9EFTDQV", // Passed securely from your backend
onSuccess: (order) => {
window.location.href = "/success";
},
onClose: () => {
alert("Checkout dismissed");
}
});React SDK (Optional)
If you use React, integrate a completely native, premium checkout modal directly over your website.
npm install @baseupi/react
import { BaseUPICheckout } from '@baseupi/react';
import '@baseupi/react/styles.css';
function CheckoutButton({ checkoutToken }) {
return (
<BaseUPICheckout
checkoutToken={checkoutToken} // Passed securely from your backend
onSuccess={() => alert("Payment confirmed!")}
onClose={() => console.log("User closed checkout")}
>
<button className="bg-blue-600 px-6 py-2 rounded">
Pay with UPI
</button>
</BaseUPICheckout>
);
}No-Code Payment Links
Perfect for freelancers or one-off payments. Create a link in the dashboard and share it anywhere.
Personal Payment Link
Create yours at baseupi.app/pay/your-name