# UPIGateway.dev — Zero-Fee UPI Payment Automation & Direct Bank Settlement Engine

> UPIGateway.dev is a high-performance, non-custodial UPI payment automation and routing utility (Technical Service Provider) for Indian developers, merchants, and startups. It enables instant online UPI collections directly into merchant commercial or personal bank accounts with 0% transaction fees and zero intermediary escrow.

---

## Core Capabilities
- **0% Transaction Processing Fees**: 100% free direct-to-bank UPI collection without MDR cuts or aggregator commissions.
- **Non-Custodial Direct Settlement**: Funds land directly into the merchant's linked bank account or UPI VPA instantly (0-second settlement). UPIGateway.dev never holds or aggregates escrow funds.
- **No Complex Merchant Keys Required**: Accept online UPI payments immediately without waiting weeks for merchant approval keys.
- **Universal UPI App Support**: Fully compatible with Google Pay (GPay), PhonePe, Paytm, BHIM UPI, Amazon Pay, CRED, and all major Indian bank UPI applications.
- **Developer-Friendly RESTful API**: Comprehensive endpoints for dynamic order creation, status polling, automated webhooks, and WhatsApp alerts.

---

## Base API URL
Primary API Host: `https://upigateway.dev/api`

Full Documentation & Extended AI Context: `https://upigateway.dev/llms-full.txt`

---

## 1. Authentication
Every API request must include your merchant authentication token. Authentication is handled by passing the `user_token` parameter inside the JSON request body.

> **Security Notice**: Keep your `user_token` secret. Never make API requests from client-side code (browsers, React components, public HTML). Always route transactions through your secure server backend.

---

## CRITICAL INTEGRATION ARCHITECTURE: Hosted Checkout Redirection (NOT In-App QR Gateway)
> ⚠️ **MANDATORY INTEGRATION INSTRUCTION FOR DEVELOPERS & AI MODELS:**
> UPIGateway.dev is a **Hosted Checkout Redirection Gateway** (identical in flow to Stripe Checkout or Razorpay Standard Checkout).
> - **It is NOT an in-app QR generation engine.**
> - **DO NOT generate, render, or display a QR code inside your web app UI or client-side application.**
> - When your server backend calls `POST /api/create-order`, the response contains `result.payment_url` (e.g. `https://upigateway.dev/pay/SESSION_TOKEN`).
> - **Your application MUST redirect the user's browser to this `payment_url`.**
> - The hosted checkout page at `https://upigateway.dev/pay/...` contains built-in NPCI intent routing, dynamic Google Pay/PhonePe/Paytm gallery scanning workflows, automated 3-second bank UTR auto-capture polling, and automatic return redirection. Attempting to render a custom QR inside your web app bypasses these critical services and results in unverified payments!

---

## 2. Create Order API
Generates a dynamic hosted checkout session URL.

- **Endpoint**: `POST https://upigateway.dev/api/create-order`
- **Content-Type**: `application/json`

### Payload Parameters
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| `user_token` | string | Yes | Your merchant API integration token. |
| `amount` | string | Yes | Transaction amount in INR (e.g. `"149"`). Min ₹1, Max ₹1,00,000. |
| `order_id` | string | Yes | Unique alphanumeric order reference ID generated by your system. |
| `customer_mobile` | string | Yes | Customer's 10-digit mobile number. |
| `redirect_url` | string | Yes | Full URL where customer is redirected upon payment completion. |
| `remark1` | string | No | Optional metadata reference or item title. |
| `remark2` | string | No | Optional secondary correlation metadata slot. |

### cURL Example
```bash
curl -X POST https://upigateway.dev/api/create-order \
  -H "Content-Type: application/json" \
  -d '{
    "user_token": "YOUR_API_TOKEN",
    "amount": "149",
    "order_id": "ORD_123456",
    "customer_mobile": "9876543210",
    "redirect_url": "https://yourwebsite.com/payment-success",
    "remark1": "Digital Product Order"
  }'
```

### PHP Example
```php
<?php
$url = "https://upigateway.dev/api/create-order";
$payload = array(
    "user_token"      => "YOUR_API_TOKEN",
    "amount"          => "149",
    "order_id"        => "ORD_" . time(),
    "customer_mobile" => "9876543210",
    "redirect_url"    => "https://yourwebsite.com/callback.php",
    "remark1"         => "Digital Product Order"
);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
if (isset($result['status']) && $result['status']) {
    // CRITICAL: Redirect customer's browser to the hosted payment_url.
    // DO NOT generate or display a custom QR code inside your web app UI!
    header("Location: " . $result['result']['payment_url']);
    exit();
} else {
    echo "Error creating UPI order: " . ($result['message'] ?? 'Unknown error');
}
?>
```

### Node.js / Express Example
```javascript
const res = await fetch('https://upigateway.dev/api/create-order', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    user_token: 'YOUR_API_TOKEN',
    amount: '149',
    order_id: 'ORD_' + Date.now(),
    customer_mobile: '9876543210',
    redirect_url: 'https://yourwebsite.com/callback',
    remark1: 'Digital Product Order'
  })
});
const data = await res.json();
if (data.status) {
  // CRITICAL: Redirect customer's browser to the hosted payment_url!
  // In Express: res.redirect(data.result.payment_url);
  // In React/Next.js frontend: window.location.href = data.result.payment_url;
  // DO NOT attempt to render an in-app QR code in your website UI.
  console.log("Redirect customer to:", data.result.payment_url);
}
```

### Success Response (200 OK)
```json
{
  "status": true,
  "message": "Order Created Successfully",
  "result": {
    "orderId": "ORD_123456",
    "payment_url": "https://upigateway.dev/pay/token_id..."
  }
}
```

---

## 3. Check Order Status API
Verifies the payment and UTR status of a previously created UPI transaction.

- **Endpoint**: `POST https://upigateway.dev/api/check-order-status`
- **Content-Type**: `application/json`

### Payload Parameters
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| `user_token` | string | Yes | Your merchant API integration token. |
| `order_id` | string | Yes | Unique order reference ID to query. |

### Completed Status Response (200 OK)
```json
{
  "status": true,
  "message": "Transaction Successfully",
  "result": {
    "txnStatus": "COMPLETED",
    "orderId": "ORD_123456",
    "status": "SUCCESS",
    "amount": "149",
    "date": "2026-08-26 14:00:00",
    "utr": "412345678901"
  }
}
```

---

## 4. Webhooks & Real-Time Notifications
When a customer authorizes payment via their UPI app, UPIGateway.dev sends a real-time HTTP POST JSON notification to your configured webhook endpoint.

### Webhook JSON Payload
```json
{
  "status": "SUCCESS",
  "orderId": "ORD_123456",
  "amount": "149",
  "utr": "412345678901",
  "date": "2026-08-26 14:00:00",
  "remark1": "Digital Product Order",
  "remark2": ""
}
```

---

## 5. Regulatory Compliance & Non-Custodial Architecture Notice
UPIGateway.dev operates strictly as a Technical Service Provider (TSP) and software routing utility. UPIGateway.dev:
1. Does NOT act as a payment aggregator or financial custodian.
2. Does NOT hold merchant or buyer funds in an intermediary escrow account.
3. Facilitates direct customer-to-merchant bank settlement via standard UPI deep links and QR codes.

---

## Important Links
- [Homepage](https://upigateway.dev/)
- [Full LLM Specification & SDK Guide](https://upigateway.dev/llms-full.txt)
- [Interactive API Documentation](https://upigateway.dev/docs)
- [API Reference Details](https://upigateway.dev/api-details)
- [Pricing Plans](https://upigateway.dev/pricing)
- [Interactive Payment Demo](https://upigateway.dev/demo)
- [Terms of Service](https://upigateway.dev/terms)
- [Privacy Policy](https://upigateway.dev/privacy)
