REST API v2.0 • Form & JSON Supported

Developer API Documentation

Integrate UPI Gateway into PHP, Node.js, React, Next.js, Android, or Flutter apps in minutes. Zero transaction charges, dynamic UPI QR & intent links, and automated webhook notifications.

Base URL: https://free.upigateway.dev Checkout Link TTL: 30 Mins Token Auth + Status Verification 0% Gateway Fee

Quick Start Integration Flow

Every merchant account authenticates using a unique user_token generated inside Dashboard → API Details. Both application/x-www-form-urlencoded and application/json request payloads are accepted across all REST endpoints.

1. Link Merchant & Token

Connect Paytm, PhonePe, HDFC, BharatPe, or GPay in your dashboard and copy your user_token.

2. Create Order Session

Call POST /api/create-order to receive a hosted payment_url valid for 30 minutes.

3. Verify & Fulfill

Receive instant webhook POST callbacks or poll POST /api/check-order-status to confirm UTR.

Clean URL & Legacy Route Support: You can call https://free.upigateway.dev/api/create-order and https://free.upigateway.dev/api/check-order-status without the .php suffix (recommended), or use the legacy .php path on POST requests for backward compatibility.
Supported Apps: UPI UPI Google Pay GPay PhonePe PhonePe Paytm Paytm FamPay FamPay BHIM BHIM CRED CRED MobiKwik MobiKwik Navi Navi

Create Order API

Initializes a new UPI payment order and generates a hosted checkout URL (/checkout/{token}) displaying dynamic QR codes and mobile UPI app intent buttons.

POST https://free.upigateway.dev/api/create-order

Request Parameters (Form-Data or JSON)

Parameter Type Requirement Description
user_token String Required Your secret merchant API token from API Details.
order_id String Required Unique alphanumeric order identifier per merchant (e.g. "ORD_100234"). Duplicates return HTTP 400.
amount Decimal / String Required Order amount in INR greater than 0 (e.g. "500.00").
customer_mobile String Recommended Customer 10-digit mobile number. Stored on order record and forwarded in webhook callback.
redirect_url URL Recommended Destination URL where the customer browser returns after payment succeeds.
remark1 String Optional Custom item title or order description (echoed back in webhook callback).
remark2 String Optional Secondary metadata reference such as user ID or plan slug (echoed back in webhook callback).

Integration Examples

curl -X POST "https://free.upigateway.dev/api/create-order" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "user_token=YOUR_USER_TOKEN" \
  -d "order_id=ORD_100234" \
  -d "amount=500.00" \
  -d "customer_mobile=9876543210" \
  -d "redirect_url=https://yourstore.com/payment-success" \
  -d "remark1=Pro Plan Upgrade" \
  -d "remark2=uid_42"
<?php
$payload = [
    'user_token'      => getenv('UPI_GATEWAY_TOKEN'),
    'order_id'        => 'ORD_' . time(),
    'amount'          => '500.00',
    'customer_mobile' => '9876543210',
    'redirect_url'    => 'https://yourstore.com/payment-success',
    'remark1'         => 'Order #100234',
    'remark2'         => 'uid_42',
];

$ch = curl_init('https://free.upigateway.dev/api/create-order');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => http_build_query($payload),
    CURLOPT_TIMEOUT        => 20,
]);

$res = json_decode(curl_exec($ch), true);
curl_close($ch);

if (!empty($res['status']) && !empty($res['result']['payment_url'])) {
    header('Location: ' . $res['result']['payment_url']);
    exit;
}
echo 'Error: ' . ($res['message'] ?? 'Request failed');
?>
const response = await fetch('https://free.upigateway.dev/api/create-order', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    user_token: process.env.UPI_GATEWAY_TOKEN,
    order_id: 'ORD_' + Date.now(),
    amount: '500.00',
    customer_mobile: '9876543210',
    redirect_url: 'https://yourstore.com/payment-success',
    remark1: 'Order #100234',
    remark2: 'uid_42'
  })
});

const data = await response.json();
if (data.status === true) {
  console.log('Checkout URL:', data.result.payment_url);
} else {
  throw new Error(data.message);
}
// Next.js Server Route (/app/api/checkout/route.js)
export async function POST(req) {
  const { orderId, amount, mobile } = await req.json();

  const res = await fetch('https://free.upigateway.dev/api/create-order', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      user_token: process.env.UPI_GATEWAY_TOKEN,
      order_id: orderId,
      amount: String(amount),
      customer_mobile: mobile,
      redirect_url: `${process.env.NEXT_PUBLIC_APP_URL}/payment-result`,
      remark1: 'Next.js Checkout'
    })
  });

  const data = await res.json();
  return Response.json(data, { status: res.status });
}
import 'package:upi_gateway_sdk/upi_gateway_sdk.dart';

final client = UpiGatewayClient(
  userToken: const String.fromEnvironment('UPI_USER_TOKEN'),
  baseUrl: 'https://free.upigateway.dev',
);

final order = await client.createOrder(
  CreateOrderRequest(
    orderId: 'ORD_${DateTime.now().millisecondsSinceEpoch}',
    amount: 500.00,
    customerMobile: '9876543210',
    redirectUrl: 'https://yourstore.com/payment-success',
    remark1: 'Flutter App Checkout',
    remark2: 'uid_42',
  ),
);

// Open hosted checkout inside UpiCheckoutPage WebView + UPI App launcher
final status = await UpiCheckoutPage.open(
  context,
  client: client,
  order: order,
);
import os, time, requests

resp = requests.post(
    'https://free.upigateway.dev/api/create-order',
    json={
        'user_token': os.environ['UPI_GATEWAY_TOKEN'],
        'order_id': f'ORD_{int(time.time())}',
        'amount': '500.00',
        'customer_mobile': '9876543210',
        'redirect_url': 'https://yourstore.com/payment-success',
        'remark1': 'Python Checkout',
        'remark2': 'uid_42',
    },
    timeout=20,
)
data = resp.json()
print(data.get('result', {}).get('payment_url'))
val client = UpiGatewayClient(
    userToken = BuildConfig.UPI_GATEWAY_TOKEN,
    baseUrl = "https://free.upigateway.dev"
)

val result = client.createOrder(
    orderId = "ORD_${System.currentTimeMillis()}",
    amount = "500.00",
    customerMobile = "9876543210",
    redirectUrl = "https://yourstore.com/payment-success",
    remark1 = "Android App Order"
)
// Launch result.paymentUrl in CustomTabsIntent or WebView

Response Payloads

{
  "status": true,
  "message": "Order Created Successfully",
  "result": {
    "orderId": "ORD_100234",
    "payment_url": "https://free.upigateway.dev/checkout/329f10a842b109c847..."
  }
}
{
  "status": false,
  "message": "Order ID already exists for this user"
}
// Other 400 messages:
// "Missing required parameters (user_token, order_id, amount required)"
// "Invalid amount specified"
// "Merchant Not Linked"
{
  "status": false,
  "message": "Unauthorized: Invalid User Token"
}
{
  "status": false,
  "message": "Subscription Plan Expired. Your 3-day free trial or subscription plan has expired. Please upgrade your plan in the merchant dashboard to continue accepting payments.",
  "error_code": "PLAN_EXPIRED"
}

Check Order Status API

Poll real-time payment state, verified amount, timestamp, and bank UTR reference for a specific order_id. Always verify status server-side before delivering digital goods or upgrading subscriptions.

POST https://free.upigateway.dev/api/check-order-status
Parameter Type Requirement Description
user_token String Required Your merchant secret API token.
order_id String Required The exact order_id submitted during order creation.

Code Examples

curl -X POST "https://free.upigateway.dev/api/check-order-status" \
  -d "user_token=YOUR_USER_TOKEN" \
  -d "order_id=ORD_100234"
<?php
$ch = curl_init('https://free.upigateway.dev/api/check-order-status');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => http_build_query([
        'user_token' => getenv('UPI_GATEWAY_TOKEN'),
        'order_id'   => 'ORD_100234',
    ]),
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

if (($data['result']['status'] ?? '') === 'SUCCESS') {
    $utr = $data['result']['utr'] ?? '';
    // Mark order paid in your database
}
?>
const res = await fetch('https://free.upigateway.dev/api/check-order-status', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    user_token: process.env.UPI_GATEWAY_TOKEN,
    order_id: 'ORD_100234'
  })
});
const data = await res.json();
if (data.result?.status === 'SUCCESS') {
  console.log('Paid! Bank UTR:', data.result.utr);
}
final status = await client.checkOrderStatus('ORD_100234');

if (status.isSuccess) {
  print('Payment confirmed! UTR: ${status.utr}');
} else if (status.isPending) {
  // Or use built-in helper: await client.pollOrderStatus('ORD_100234');
}

All Status Response Variants

{
  "status": "COMPLETED",
  "message": "Transaction Successfully",
  "result": {
    "txnStatus": "COMPLETED",
    "resultInfo": "Transaction Success",
    "orderId": "ORD_100234",
    "status": "SUCCESS",
    "amount": "500.00",
    "date": "2026-11-26 09:49:06",
    "utr": "423984710293"
  }
}
{
  "status": "COMPLETED",
  "message": "Transaction Pending",
  "result": {
    "txnStatus": "PENDING",
    "resultInfo": "Transaction Pending",
    "orderId": "ORD_100234",
    "status": "PENDING",
    "amount": "500.00",
    "date": "2026-11-26 09:49:06"
  }
}
{
  "status": "COMPLETED",
  "message": "Transaction Failed",
  "result": {
    "txnStatus": "FAILURE",
    "resultInfo": "Transaction Failed",
    "orderId": "ORD_100234",
    "status": "FAILURE",
    "amount": "500.00",
    "date": "2026-11-26 09:49:06"
  }
}
{
  "status": "COMPLETED",
  "message": "Order not found",
  "result": null
}

Realtime Webhook Callbacks

Configure your Webhook Callback URL in API Details. When an order status becomes SUCCESS, the gateway dispatches a server-to-server HTTP POST request.

OUTBOUND POST Content-Type: application/x-www-form-urlencoded
Timeout: 10s
Security Best Practice (Important): Webhook callbacks use standard URL-encoded form fields (read via $_POST in PHP or express.urlencoded() in Node.js — not php://input JSON). Never trust webhook body alone: always call /api/check-order-status with your secret user_token inside your handler to confirm status === "SUCCESS", exact amount, and bank utr!
Form Field Example Value Description
status "SUCCESS" Order status string sent when payment succeeds.
order_id "ORD_100234" Your merchant order identifier.
customer_mobile "9876543210" Customer mobile number recorded on the order.
amount "500.00" Order payment amount in INR.
remark1 "Order #100234" Custom primary remark submitted on creation.
remark2 "uid_42" Custom secondary remark submitted on creation.

Verified Webhook Handler Snippets

<?php
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    http_response_code(405);
    exit;
}

$orderId = trim($_POST['order_id'] ?? '');
$status  = trim($_POST['status'] ?? '');

if ($orderId === '' || $status !== 'SUCCESS') {
    http_response_code(400);
    exit('Ignored');
}

// Re-verify directly with the gateway before fulfilling order
$ch = curl_init('https://free.upigateway.dev/api/check-order-status');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => http_build_query([
        'user_token' => getenv('UPI_GATEWAY_TOKEN'),
        'order_id'   => $orderId,
    ]),
]);
$verify = json_decode(curl_exec($ch), true);
curl_close($ch);

if (($verify['result']['status'] ?? '') === 'SUCCESS') {
    $utr    = $verify['result']['utr'] ?? '';
    $amount = (float)($verify['result']['amount'] ?? 0);
    // TODO: Idempotently update your database if amount matches expected order total
}

http_response_code(200);
echo 'OK';
?>
app.post('/webhook/upi', express.urlencoded({ extended: false }), async (req, res) => {
  const { order_id, status } = req.body || {};
  if (!order_id || status !== 'SUCCESS') {
    return res.status(400).send('Ignored');
  }

  const verifyRes = await fetch('https://free.upigateway.dev/api/check-order-status', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      user_token: process.env.UPI_GATEWAY_TOKEN,
      order_id
    })
  });
  const verified = await verifyRes.json();

  if (verified?.result?.status === 'SUCCESS') {
    // Verified UTR: verified.result.utr
    // Idempotently credit user / mark order paid
  }
  res.status(200).send('OK');
});

Interactive API Request Tester

Send live POST requests directly from your browser using your merchant user_token to inspect exact HTTP status codes and JSON payloads.

Format:
Target: https://free.upigateway.dev/api/create-order

Plan Tiers & Gateway Eligibility

/api/create-order automatically routes orders using your active subscription tier and default merchant preference (defqr). Gateways outside your active tier are automatically blocked until upgraded.

Plan Tier Paytm Business FamPay PhonePe Business HDFC SmartHub BharatPe Google Pay
Free Plan (3 Days) Included Paid Plans Pro+ Pro+ Business+ Enterprise
Starter (Paid) Included Included Pro+ Pro+ Business+ Enterprise
Pro Included Included Included Included Business+ Enterprise
Business Included Included Included Included Included Enterprise
Enterprise Included Included Included Included Included Included

HTTP Status & Error Reference

Inspect standard HTTP status codes and error messages returned by the REST endpoints.

HTTP Code Sample Message / Error Code Cause & Resolution
200 / 201 Order Created Successfully / COMPLETED Order created or status retrieved successfully.
400 Missing required parameters / Invalid amount Ensure user_token, order_id, and numeric amount > 0 are sent via POST.
400 Order ID already exists for this user Generate a strictly unique order_id for every payment attempt.
400 Merchant Not Linked Connect at least one UPI merchant gateway allowed by your active plan in Dashboard.
401 Unauthorized: Invalid User Token Check your user_token in API Details; regenerating tokens invalidates older keys.
403 PLAN_EXPIRED / Banned / Locked Renew your subscription plan inside Subscription or contact support.
404 Order not found No order matches that order_id under your user_token.

Official SDKs & Flutter Support

Pre-configured ZIP libraries pointing directly to https://free.upigateway.dev. Log into your merchant account to download any package directly.

v1.0.0 • NEW
Flutter SDK (Dart)

Client, status polling & In-App checkout widget.

flutter.zip
v2.4.0
PHP Backend SDK

cURL client, status check & webhook receiver.

php.zip
v1.8.2
Node.js & TS SDK

Zero-dependency client with TypeScript definitions.

nodejs.zip
v2.1.0
React & Next.js

Hooks, button component & API route handler.

react.zip
v3.0.1
Android (Kotlin)

Coroutine client & checkout activity starter.

android.zip
v2.0.0
Postman & HTML5

Collection, bash templates & web embed.

View All SDKs

Ready to Accept 0% Fee UPI?

Get started with our 3-day free trial, generate your API token, and deploy checkout flows across web and mobile apps.