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.
Quickstart in 6 Steps
Integrate autoUPI Gateway into your existing website, billing software, or mobile app in under 10 minutes.
- 1Create an account and sign in to the merchant management console.
- 2Connect an account — pair your PhonePe or Paytm merchant handles on the Connect Accounts screen to receive direct bank credits.
- 3Generate an API key on the API Keys page. Store it securely in your server environment variables.
- 4Create an order by sending a POST request to
/create-orderand redirect the payer to the returnedpayment_url. - 5Set 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_urlandfailure_redirect_urlon create-order. - 6Verify & fulfill the purchase using cryptographic signature validation or by querying the order status endpoint.
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.
X-API-Key: augw_live_xxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/jsonAPI Key Hygiene: If you suspect a key compromise, regenerate it immediately from the merchant console. Regenerating instantly invalidates the previous key across all endpoints.
Create Order
Initialize a dynamic UPI payment request for your customer with amount-locking and unique tracking metadata.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| amount | number | Required | Order amount in INR (minimum ₹1, maximum ₹10,00,000). Decimals permitted. |
| customer_name | string | Optional | Customer name shown on the hosted payment interface and QR checkout. |
| webhook_url | string | Optional | Full HTTPS destination URL that receives the signed payment.paid webhook event. |
| success_redirect_url | string | Optional | Full 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_url | string | Optional | Full 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_type | string | Optional | Session behavior: one_time (default, auto-expires) or reusable. |
Integration Snippets
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)
{
"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.
Order Status
Poll this endpoint to retrieve the real-time fulfillment status of an order after the payer returns to your thank-you page.
curl "https://autoupigateway.com/api/public/v1/order-status?order_id=ORD20260915A1B2C3" \
-H "X-API-Key: augw_live_your_key"Response Example (200 OK)
{
"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
| Status | Description | Action Required |
|---|---|---|
active | Awaiting UPI payment. Sessions remain active for 5 minutes. | Poll every 3–5 seconds or wait for signed webhook callback. |
paid | Direct bank credit confirmed on connected UPI rails. | Fulfill customer order and issue invoice. |
expired | No payment detected within the 5-minute timeout window. | Prompt customer to generate a fresh payment link. |
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
POST https://yoursite.com/autoupi-webhook.php
X-AutoUPIGateway-Signature: t=1789453200,v1=6f3c4821a941efb396781290bbfa6e...
Content-Type: application/jsonPayload Example
{
"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
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");
});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.
<?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"]);
}
}<?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;<?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";API Error Codes
autoUPI Gateway utilizes conventional HTTP status codes alongside explicit machine-readable error strings.
| HTTP Status | Error Code | Resolution |
|---|---|---|
401 Unauthorized | invalid_api_key | Secret key is missing, invalidated, or replaced by regeneration. Verify your environment credentials. |
400 Bad Request | invalid_amount | Order amount must be greater than 0 and less than or equal to ₹10,00,000. |
400 Bad Request | UPI_NOT_CONFIGURED | No active merchant UPI account configured. Visit Connect Accounts on your dashboard first. |
400 Bad Request | QUOTA_EXCEEDED | Your plan QR limit has been exhausted for the billing cycle. Upgrade to a higher tier under Pricing. |
400 Bad Request | ALL_PAYMENT_SLOTS_BUSY | Too many simultaneous orders at the exact same price. Retry in a few seconds or upgrade your plan. |
400 Bad Request | invalid_success_redirect_urlinvalid_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 Found | not_found | The requested order_id does not exist or does not belong to the authenticated API key. |
Subscription Pricing Plans
Direct UPI collections with zero commission. Instant automated activation for your business. Money hits your own bank account directly.
Free
- 5 QR codes in total
- Limited Order / Payment link creation
- Basic analytics dashboard
- Community support
Basic
- 1,000 QR codes in 30 days
- Limited Order / Payment link creation
- Signed webhooks & API access
- Instant automated activation
- Standard support
Plus
- 3,000 QR codes in 30 days
- Limited Order / Payment link creation
- Signed webhooks & API access
- Instant automated activation
- Priority WhatsApp & Email
Pro
- Unlimited QR codes
- Unlimited Order / Payment link support
- Signed webhooks & API access
- Instant automated activation
- 24/7 Dedicated Priority support
Frequently Asked Questions
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.
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.
Hosted links remain active for 5 minutes. If unfulfilled, the session gracefully expires and moves to your historical logs.
PHP 7.4 through PHP 8.3+ with the standard cURL extension enabled. No external composer packages or dependencies needed.
Yes. Key regeneration is immediate and can be executed at will from your API Keys dashboard tab.
Zero percent. You only pay the flat subscription price. 100% of your gross sales remain untouched in your bank account.