REST API Reference
Integrate direct 0% fee UPI collections into your website, SaaS, or Telegram bot using TruexGateway's JSON endpoints. Create dynamic QR orders and auto-verify UTRs across Paytm, BharatPe, and FamPay.
Authentication
To authenticate API requests from your backend server, include your secret API key in the request headers. You can generate API keys inside your TruexGateway Merchant Dashboard.
Note: If your client is authenticated via the browser dashboard, session cookies will be verified automatically.
/api/create-order.php
Initializes a new UPI payment order on your active merchant gateway. Returns a unique internal `TXG...` order ID, a ready-to-use public checkout URL, a direct QR code URL, and the raw UPI intent URI.
| Parameter | Type | Requirement | Description |
|---|---|---|---|
amount |
string | Required | Payment amount in INR (e.g., "499.00"). Min: ₹1, Max: ₹1,00,000. |
orderRef |
string | Required | Your internal unique order ID (max 64 chars). Embedded in the UPI `tr` parameter. |
description |
string | Optional | Payment note shown to the customer on their UPI app. |
/api/generate-qr.php
Returns a direct HTTP redirect to a high-resolution QR code image backed by Cloudflare CDN. You can embed this URL directly into an HTML <img src="..."> tag or Telegram bot photo payload.
| Query Param | Requirement | Description |
|---|---|---|
orderId |
Required | The internal TXG... order ID returned by the create-order endpoint. |
public |
Optional | Set to 1 to allow public checkout rendering without session headers. |
/api/payment-status.php
The master auto-verification polling endpoint. It checks the live database and queries your connected gateway engine (Paytm Offline Status API, FamPay Gmail IMAP, or BharatPe Tesseract API) to verify UTR and lock the payment in real time.
| Query Param | Requirement | Description |
|---|---|---|
orderId |
Required | The internal TXG... order ID to verify. |
public |
Optional | Set to 1 for frontend checkout status polling. |
HTTP Error Codes
Standard HTTP status codes are returned by all TruexGateway API endpoints.
| Status Code | Meaning | Description |
|---|---|---|
| 200 OK | Success | The request was successfully processed and executed. |
| 400 Bad Request | Validation Error | Missing required parameters or invalid formatting (e.g., negative amount). |
| 401 Unauthorized | Auth Failed | API key is missing, invalid, or the session has expired. |
| 403 Forbidden | Access Denied | The merchant account is blocked or action is not permitted. |
| 429 Too Many Requests | Rate Limited | You have exceeded the allowed API calls per minute. Slow down. |
| 500 Internal Error | Server Error | An unexpected database or server failure occurred. |