Getting Started

autoUPI Gateway Developer Documentation

A high-throughput, self-serve UPI payment gateway designed for Indian online businesses. Create orders programmatically from your backend, route customers to amount-locked dynamic UPI checkout screens, and receive signed webhook alerts the millisecond funds hit your bank.

Base URLhttps://autoupigateway.com/api/public/v1
Payload Formatapplication/json
AuthenticationX-API-Key
Onboarding

Quickstart in 6 Steps

Integrate autoUPI Gateway into your existing website, billing software, or mobile app in under 10 minutes.

  1. 1
    Create an account and sign in to the merchant management console.
  2. 2
    Connect an account — pair your PhonePe or Paytm merchant handles on the Connect Accounts screen to receive direct bank credits.
  3. 3
    Generate an API key on the API Keys page. Store it securely in your server environment variables.
  4. 4
    Create an order by sending a POST request to /create-order and redirect the payer to the returned payment_url.
  5. 5
    Set your redirect URLs on the Config page — default success and failed URLs plus one webhook. Per-order redirects can also be sent as success_redirect_url and failure_redirect_url on create-order.
  6. 6
    Verify & fulfill the purchase using cryptographic signature validation or by querying the order status endpoint.
Security & Credentials

Authentication

All HTTP requests to the autoUPI Gateway public REST API require your secret key transmitted via the X-API-Key request header.

Production secret keys begin with augw_live_ (legacy keys prefixed with payupi_live_ or aupi_live_ remain completely supported). Keys are hashed at rest in our infrastructure. Only invoke the API from your backend server; never expose secret API credentials in client-side JavaScript or mobile APK binaries.

HTTP Header
X-API-Key: augw_live_xxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json

API Key Hygiene: If you suspect a key compromise, regenerate it immediately from the merchant console. Regenerating instantly invalidates the previous key across all endpoints.

Core REST Endpoints

Create Order

Initialize a dynamic UPI payment request for your customer with amount-locking and unique tracking metadata.

POST/api/public/v1/create-order

Request Body

ParameterTypeRequiredDescription
amountnumberRequiredOrder amount in INR (minimum ₹1, maximum ₹10,00,000). Decimals permitted.
customer_namestringOptionalCustomer name shown on the hosted payment interface and QR checkout.
webhook_urlstringOptionalFull HTTPS destination URL that receives the signed payment.paid webhook event.
success_redirect_urlstringOptionalFull http:// or https:// URL opened after a successful payment, with ?order_id=…&status=paid added. Omit it to use your Config success URL. Send only your own site’s page.
failure_redirect_urlstringOptionalFull http:// or https:// URL opened when the link expires (status=failed) or the payer cancels (status=cancelled). Omit it to use your Config failed URL.
link_typestringOptionalSession behavior: one_time (default, auto-expires) or reusable.

Integration Snippets

cURL
curl -X POST https://autoupigateway.com/api/public/v1/create-order \
  -H "X-API-Key: augw_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"amount": 1499, "customer_name": "Rahul Sharma", "success_redirect_url": "https://yoursite.com/payment/success", "failure_redirect_url": "https://yoursite.com/payment/failed"}'

Response Example (200 OK)

200 OK — JSON Response
{
  "ok": true,
  "order_id": "ORD20260915A1B2C3",
  "slug": "9fkq2wra",
  "amount": 1499,
  "payable_amount": 1499.37,
  "status": "active",
  "payment_url": "https://autoupigateway.com/pay/9fkq2wra"
}

Crucial Note on payable_amount: To prevent collisions when multiple customers pay the same base price simultaneously, the gateway assigns a fractional offset (e.g. ₹1,499.37). The customer pays exactly payable_amount, and your account is credited with the base amount.

Per-order redirects: Pass success_redirect_url and failure_redirect_url so the payer returns to that site after paid, expire, or cancel. Omit either to use the matching Config URL. The webhook stays account-wide. Do not treat ?status=paid on the redirect as proof of payment — confirm with the signed webhook or the Order Status API.

Polling & Verification

Order Status

Poll this endpoint to retrieve the real-time fulfillment status of an order after the payer returns to your thank-you page.

GET/api/public/v1/order-status?order_id=ORD...
cURL
curl "https://autoupigateway.com/api/public/v1/order-status?order_id=ORD20260915A1B2C3" \
  -H "X-API-Key: augw_live_your_key"

Response Example (200 OK)

200 OK — Order Status Payload
{
  "ok": true,
  "order": {
    "order_id": "ORD20260915A1B2C3",
    "slug": "9fkq2wra",
    "customer_name": "Rahul Sharma",
    "amount": 1499,
    "payable_amount": 1499.37,
    "status": "paid",
    "payer_name": "RAHUL SHARMA",
    "paid_at": "2026-09-15T10:21:44.120Z",
    "detected_at": "2026-09-15T10:21:52.480Z",
    "expires_at": "2026-09-15T10:26:00.000Z"
  }
}

Status Lifecycle

StatusDescriptionAction Required
activeAwaiting UPI payment. Sessions remain active for 5 minutes.Poll every 3–5 seconds or wait for signed webhook callback.
paidDirect bank credit confirmed on connected UPI rails.Fulfill customer order and issue invoice.
expiredNo payment detected within the 5-minute timeout window.Prompt customer to generate a fresh payment link.
Instant Notifications

Webhooks & Signatures

Receive real-time signed POST events as soon as UPI credits are detected. Webhook notifications eliminate polling latency and give your application instant fulfillment triggers.

Each secret key is paired with a unique webhook signing secret (prefixed with whsec_) accessible on your API Keys dashboard. We sign all payloads using HMAC-SHA256 and deliver the cryptographic signature in the X-AutoUPIGateway-Signature header.

Webhook Header Signature Format

Headers
POST https://yoursite.com/autoupi-webhook.php
X-AutoUPIGateway-Signature: t=1789453200,v1=6f3c4821a941efb396781290bbfa6e...
Content-Type: application/json

Payload Example

payment.paid Event Payload
{
  "event": "payment.paid",
  "order_id": "ORD20260915A1B2C3",
  "slug": "9fkq2wra",
  "amount": 1499,
  "payable_amount": 1499.37,
  "payer_name": "RAHUL SHARMA",
  "paid_at": "2026-09-15T10:21:44.120Z",
  "timestamp": 1789453200
}

Signature Verification Logic

Node.js (Express)
import { createHmac, timingSafeEqual } from "crypto";

app.post("/autoupi-webhook", express.raw({ type: "application/json" }), (req, res) => {
  const sigHeader = req.headers["x-autoupigateway-signature"];
  const secret = process.env.AUTOUPI_WEBHOOK_SECRET; // whsec_...

  const params = Object.fromEntries(
    sigHeader.split(",").map((kv) => kv.split("="))
  );
  const { t, v1 } = params;

  const expected = createHmac("sha256", secret)
    .update(`${t}.${req.body.toString("utf8")}`)
    .digest("hex");

  if (!timingSafeEqual(Buffer.from(v1), Buffer.from(expected))) {
    return res.status(401).send("Invalid signature");
  }

  const event = JSON.parse(req.body.toString("utf8"));
  if (event.event === "payment.paid") {
    // Fulfill order idempotent check:
    markOrderPaid(event.order_id, event.amount);
  }

  res.status(200).send("ok");
});
Complete SDK Walkthrough

PHP Integration in 3 Files

Copy these three standalone scripts into any PHP framework (WordPress, Laravel, CodeIgniter or raw PHP). Zero composer dependencies required — standard cURL is all you need.

1. autoupigateway.php — Client SDK Class
<?php
class AutoUpiGateway {
  private string $key;
  private string $base;

  public function __construct(string $key, string $base = "https://autoupigateway.com/api/public/v1") {
    $this->key = $key;
    $this->base = $base;
  }

  private function request(string $url, ?array $body = null): array {
    $ch = curl_init($url);
    $headers = ["X-API-Key: {$this->key}"];
    if ($body !== null) {
      $headers[] = "Content-Type: application/json";
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
    }
    curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => $headers,
      CURLOPT_TIMEOUT => 20
    ]);
    $res = json_decode(curl_exec($ch), true);
    curl_close($ch);
    return is_array($res) ? $res : ["ok" => false, "error" => "network_error"];
  }

  public function createOrder(float $amount, string $customer = "", string $webhook = ""): array {
    return $this->request($this->base . "/create-order", [
      "amount" => $amount,
      "customer_name" => $customer,
      "webhook_url" => $webhook,
    ]);
  }

  public function status(string $orderId): array {
    return $this->request($this->base . "/order-status?order_id=" . urlencode($orderId));
  }

  public static function verify(string $raw, string $header, string $secret): bool {
    parse_str(str_replace(",", "&", $header), $p);
    if (empty($p["t"]) || empty($p["v1"])) return false;
    return hash_equals(hash_hmac("sha256", $p["t"] . "." . $raw, $secret), $p["v1"]);
  }
}
2. checkout.php — Initiate Payment Session
<?php
require "autoupigateway.php";
$api = new AutoUpiGateway("augw_live_your_key");

$order = $api->createOrder(1499, "Rahul Sharma", "https://yoursite.com/autoupi-webhook.php");

if (empty($order["ok"])) {
  die("Could not start payment: " . ($order["error"] ?? "unknown"));
}

// Record order_id into database before redirecting:
save_order($order["order_id"], $_SESSION["user_id"], $order["amount"]);

header("Location: " . $order["payment_url"]);
exit;
3. autoupi-webhook.php — Instant Payment Confirmation
<?php
require "autoupigateway.php";

$raw = file_get_contents("php://input");
$sig = $_SERVER["HTTP_X_AUTOUPIGATEWAY_SIGNATURE"] ?? "";

if (!AutoUpiGateway::verify($raw, $sig, "whsec_your_webhook_secret")) {
  http_response_code(401);
  exit("bad signature");
}

$event = json_decode($raw, true);
if (($event["event"] ?? "") === "payment.paid") {
  mark_order_paid($event["order_id"], $event["amount"]);
}

http_response_code(200);
echo "ok";
Reference

API Error Codes

autoUPI Gateway utilizes conventional HTTP status codes alongside explicit machine-readable error strings.

HTTP StatusError CodeResolution
401 Unauthorizedinvalid_api_keySecret key is missing, invalidated, or replaced by regeneration. Verify your environment credentials.
400 Bad Requestinvalid_amountOrder amount must be greater than 0 and less than or equal to ₹10,00,000.
400 Bad RequestUPI_NOT_CONFIGUREDNo active merchant UPI account configured. Visit Connect Accounts on your dashboard first.
400 Bad RequestQUOTA_EXCEEDEDYour plan QR limit has been exhausted for the billing cycle. Upgrade to a higher tier under Pricing.
400 Bad RequestALL_PAYMENT_SLOTS_BUSYToo many simultaneous orders at the exact same price. Retry in a few seconds or upgrade your plan.
400 Bad Requestinvalid_success_redirect_url
invalid_failure_redirect_url
The matching URL must be http:// or https://, max 500 characters, with no credentials in the URL. Omit the field to use your Config default for that outcome.
404 Not Foundnot_foundThe requested order_id does not exist or does not belong to the authenticated API key.
Simple & Transparent

Subscription Pricing Plans

Direct UPI collections with zero commission. Instant automated activation for your business. Money hits your own bank account directly.

Free

Plan:Forever Free
₹0lifetime
✨ 100% Free · No credit card required
  • 5 QR codes in total
  • Limited Order / Payment link creation
  • Basic analytics dashboard
  • Community support
Start Free

Basic

Actual price:₹2,999
₹999/-/ 30 days
🔥 Save 67%
  • 1,000 QR codes in 30 days
  • Limited Order / Payment link creation
  • Signed webhooks & API access
  • Instant automated activation
  • Standard support
Get Basic
Unlimited Power

Pro

Actual price:₹14,999
₹4,999/-/ 30 days
🔥 Save 67%
  • Unlimited QR codes
  • Unlimited Order / Payment link support
  • Signed webhooks & API access
  • Instant automated activation
  • 24/7 Dedicated Priority support
Get Pro
Support

Frequently Asked Questions

Do I need a commercial merchant payment gateway account?

No. Payments are received directly by your connected PhonePe or Paytm UPI account. autoUPI Gateway verifies the transaction on the UPI rails and triggers automated webhooks.

How does the gateway handle two orders of the same amount?

The engine automatically issues a fractional offset (e.g. ₹499.12 vs ₹499.28) so each active pending checkout has an unmistakable payable amount for instant settlement detection.

How long is a generated payment link active?

Hosted links remain active for 5 minutes. If unfulfilled, the session gracefully expires and moves to your historical logs.

Which PHP version is supported?

PHP 7.4 through PHP 8.3+ with the standard cURL extension enabled. No external composer packages or dependencies needed.

Can I regenerate secret API keys anytime?

Yes. Key regeneration is immediate and can be executed at will from your API Keys dashboard tab.

Are there any hidden transaction commissions?

Zero percent. You only pay the flat subscription price. 100% of your gross sales remain untouched in your bank account.