REST API v2 · TypeScript & Node.js

Developer Hub & UPI API Integration

Build reliable UPI & Web3 checkouts with server-side order creation, idempotency keys, dynamic QR / Intent routing, and HMAC-SHA256 signed webhooks.

Server-Side Orders

Create orders from your backend with secret keys so amounts cannot be tampered with client-side.

Idempotency Keys

Safely retry network requests using Idempotency-Key headers without creating duplicate charges.

Signed Webhooks

Verify every payment.succeeded event with constant-time HMAC-SHA256 signature validation.

UPI Intent vs QR

Serve 1-tap PhonePe/GPay/Paytm intents on mobile and high-res dynamic QR codes on desktop.

Quickstart Snippets (TypeScript / Node.js)

Copy-paste these production patterns to create idempotent orders and verify webhook payloads.

1. Create Order (Server-Side + Idempotency)
// Server-side order creation with idempotency key (Node.js / TypeScript)
const response = await fetch("https://api.upigateways.in/v2/orders", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.UPIGATEWAYS_SECRET_KEY}`,
    "Idempotency-Key": `order_${orderId}`,
  },
  body: JSON.stringify({
    order_id: orderId,
    amount: 499.00,
    currency: "INR",
    customer_name: "Aarav Sharma",
    redirect_url: "https://yoursite.com/payment/callback",
  }),
});

const order = await response.json();
// Redirect customer to order.payment_url or dispatch order.upi_intent
2. Verify HMAC-SHA256 Webhook Signature
import crypto from "node:crypto";

export function verifyWebhookSignature(
  rawBody: string,
  signatureHeader: string,
  webhookSecret: string
): boolean {
  const expected = crypto
    .createHmac("sha256", webhookSecret)
    .update(rawBody, "utf8")
    .digest("hex");

  return crypto.timingSafeEqual(
    Buffer.from(signatureHeader),
    Buffer.from(expected)
  );
}

How to integrate UPI payment gateway in website?

To integrate a UPI payment gateway in your website, create a server-side order via our REST API using your secret key and an Idempotency-Key header. Redirect customers to the returned payment_url or render the dynamic QR/UPI Intent, then confirm settlement via HMAC-SHA256 signed webhooks.

Is the UPI API open source?

While NPCI's core UPI switching infrastructure is proprietary to banks, UPI Gateways provides open-source TypeScript, Node.js, Python, and PHP SDKs plus sample integration repositories on GitHub. You connect those open-source SDKs to our hosted REST API for instant order creation and webhook verification.

Can I integrate UPI payment gateway in my website without GST?

Yes. Sole proprietors, freelancers, and small businesses below the statutory GST threshold can integrate UPI Gateways using their PAN, bank account, and Aadhaar/eKYC verification. GSTIN is only required if your business turnover exceeds the mandatory GST registration limit.

Ready to grab your API keys?

Generate live & test API credentials and test webhook payloads in your dashboard.

Get API Keys