ZexiPay
Developer reference

API documentation

Server-side REST endpoints and signed payment events for ZexiPay integrations.

ZexiPay API Reference

Use one unified server API for hosted payment pages and checkout inside your website or mobile app. Production keys require a connected recipient account (PhonePe Business, BharatPe, FamPay, or Paytm).

request_headers.txt
Base URL: https://zexipay.com
Content-Type: application/json
X-API-Key: your_server_side_api_key
X-API-Secret: your_server_side_api_secret

Get your keys from your merchant dashboard. Keep both keys on your server. Mobile apps and browser JavaScript call your own backend, which checks the signed-in user's access to the order.

Payment Rule: A top-level status: success means the API call worked. A payment is confirmed only when data.payment_status is success in a verified status response.

Authentication

Send X-API-Key and X-API-Secret in the request headers. Use separate credentials for sandbox and production. Store both credentials on your server.

1. Create an Order

Send a POST /api/create-order request from your server backend. Calculate the price from your own database and create a durable local order first.

create_order.json
{
  "order_id": "ORDER_1001",
  "amount": "100.00",
  "customer_name": "Rahul Sharma",
  "customer_mobile": "+919876543210",
  "callback_url": "https://yourwebsite.com/payment-callback",
  "is_reusable": false
}
Field Type & Contract
order_id Required ASCII string, 1–100 chars (letters, digits, underscore, dot, hyphen). Unique per merchant.
amount Required decimal string/number, 0.01–500,000.00 INR; at most two decimal places.
customer_name Required string, at most 100 bytes.
customer_mobile Optional string, 7–15 digits, optional leading +.
callback_url Optional HTTPS URL for customer redirect after payment completion.
expiry_hours Optional integer, default 24; zero means no link expiration.
is_reusable Optional boolean, default false. Keep false for individual shopping cart orders.

HTTP 201 returns data.payment_url, order_id, token, amount, currency, customer_name, expires_at, created_at. An identical retry returns HTTP 200. Changing fields for the same order ID returns HTTP 409.

3. Verify and Fulfil Once

Call POST /api/check-status with {"order_id":"your-order-id"} to query transaction status: pending, success, or failed.

check_status_response.json
{
  "status": "success",
  "data": {
    "order_id": "ORDER_1001",
    "amount": 100.00,
    "payment_status": "success",
    "utr": "412280250368",
    "payment_method": "PhonePe UPI",
    "provider": "phonepe",
    "paid_at": "2026-11-09 01:20:15"
  }
}

Compare the returned amount, currency, and order ID against your database. Fulfill the purchase exactly once inside a database transaction.

4. Signed Webhook Notifications

Register your HTTPS endpoint in your merchant dashboard. ZexiPay sends instant payment.success webhook events with HMAC-SHA256 signatures.

verify_webhook.php
// PHP receiver: Validate raw bytes before JSON parsing
$raw = file_get_contents('php://input');
$stamp = $_SERVER['HTTP_X_ZEXIPAY_TIMESTAMP'] ?? '';
$id = $_SERVER['HTTP_X_ZEXIPAY_EVENT_ID'] ?? '';
$sig = $_SERVER['HTTP_X_ZEXIPAY_SIGNATURE_V2'] ?? '';
$secret = 'your_webhook_signing_secret';

if (!$secret || !ctype_digit($stamp) || abs(time() - (int)$stamp) > 300
    || !hash_equals(hash_hmac('sha256', $stamp.'.'.$id.'.'.$raw, $secret), $sig)) {
    http_response_code(401);
    exit('Invalid signature');
}

$event = json_decode($raw, true);
// Fulfill order safely and acknowledge quickly
http_response_code(200);
echo json_encode(['received' => true]);

5. Errors & Rate Limits

HTTP Code Meaning & Resolution
400 / 422 Malformed JSON, missing fields, or invalid amount. Fix request body.
401 Invalid API key or secret. Confirm credentials in merchant panel.
404 Order ID not found for this merchant.
409 Conflict (conflicting order fields or no active recipient account).
429 Rate limit exceeded (100 requests/minute per key). Back off and retry.
5xx Temporary gateway error. Retry safely with the same order ID.

Rate limits

The supplied integration guide documents 100 requests per minute per API key. Monthly order quotas also apply. Inspect the response on a 429 before retrying.

Changelog

API v2.0.0 documents hosted and embedded checkout, nonpayable sandbox flows and signed payment.success webhooks.

2A. Hosted Payment Page

Open the returned data.payment_url in your customer's browser. The customer pays on the secure gateway checkout page. On callback or return to your app, your backend verifies the payment status. Redirect fields never authorize order fulfillment on their own.

2B. In-App Embedded Checkout

Send POST /api/prepare-checkout with {"order_id":"your-saved-order-id"} and the same authentication headers. A successful response contains:

Response Field Description & Recommended Use
amount The exact payable INR amount. Save this on your server before displaying the QR.
upi_uri Canonical UPI URI. Render a local QR code or open a mobile UPI intent app on tap.
qr_image_url Ready-made QR code image URL for instant display in your application.
payment_note Keep unchanged so receipt matching identifies this order.
expires_at_unix Unix timestamp in seconds; use for customer countdown timer and expiry.
order_id, provider, payee_name Order identity, active payment gateway engine, and business name.

Integration prompt

Integration prompt
Integrate ZexiPay into my existing application using its real API contract. Preserve the application's design, login, cart and order logic. First inspect my stack and explain any required server configuration. Do not invent endpoints, credentials, payment results, or demo orders.

Gateway base URL: https://zexipay.com
API contract: https://zexipay.com/openapi.php
Documentation: https://zexipay.com/docs.php
Credentials: server-only ZEXIPAY_API_KEY and ZEXIPAY_API_SECRET. Never put either in browser JS, mobile binaries, localStorage, public env variables or logs. Native/mobile apps must call my own authenticated backend.

1. Create a durable local order from authenticated customer/cart data. Determine amount on my backend in integer paise. Save a unique order_id (1–100 ASCII letters/digits/underscore/dot/colon/hyphen; start with letter or digit). Use the SAME order_id and IDENTICAL fields to retry an ambiguous create request. Never create duplicate purchases on retries.
2. Backend POST JSON https://zexipay.com/api/create-order, headers Content-Type: application/json, X-API-Key, X-API-Secret. Required fields: order_id (string), amount (INR decimal string, 0.01 to 500000.00), customer_name (string). Optional: description, customer_mobile, callback_url, expiry_hours (0 to 8760; zero = no link expiry), is_reusable (false for checkout). Read data.payment_url. HTTP 201 means created; 200 means the identical existing order. A top-level status=success here only means the API operation succeeded, NOT payment received.
3. Hosted checkout: redirect/open data.payment_url. Callback query parameters are untrusted navigation only. Never fulfil from a redirect, UTR entered by the customer, screenshots, frontend state or a UPI deep-link return.
4. In-app checkout: backend POST https://zexipay.com/api/prepare-checkout with {"order_id": savedOrderId}, same auth headers. Display data.amount exactly, including reserved paise; it can differ from data.requested_amount. Save both expected payable amount and original requested_amount to my local order BEFORE showing QR. Display data.qr_image_url or render data.upi_uri using a QR library; launch data.upi_uri from a user tap. Keep payment_note unchanged. Respect expires_at_unix. Do NOT iframe the gateway (SAMEORIGIN policy). Embedded checkout only supports single-use production orders. It still opens the customer's UPI app to authorize payment.
5. My backend POST https://zexipay.com/api/check-status with {"order_id": savedOrderId}. Browser/mobile polls my own authorized status endpoint about every 5 seconds while checkout is open, with backoff for 429/503. Read data.payment_status (pending/success/failed/refunded), not top-level status. Fulfil exactly once in a local DB transaction ONLY after server verification gives success AND returned order_id, INR currency and payable amount match the saved order. Record UTR and provider reference when present. Stop normal polling on terminal states; allow support reconciliation if paid near expiry.
6. Add my server webhook endpoint and register it in ZexiPay Webhooks. Automatic payment notifications currently emit payment.success only. The manual connection test uses webhook.test: verify its signature, acknowledge 2xx, and never fulfil from it. Read RAW bytes before JSON parsing. Preferred verification: X-ZexiPay-Signature-V2 = lowercase hex HMAC-SHA256(timestamp + '.' + eventId + '.' + rawBody, webhookSecret), using X-ZexiPay-Timestamp and X-ZexiPay-Event-Id; reject timestamps beyond 300 seconds and compare in constant time. Legacy header X-ZexiPay-Signature = HMAC-SHA256(rawBody, webhookSecret) is also supplied. Use a separate webhook secret, never the API secret. Verify event_id matches the signed header and deduplicate it in a durable unique DB row. Gateway retries reuse event ID, with fresh timestamp. Persist work and return 2xx quickly, then verify via check-status and fulfil idempotently. Keep a server reconciliation path in case a webhook is delayed. Never mark a payment paid based on an unsigned POST.
7. Handle invalid auth (401), validation (400/422), order conflicts or missing payment account (409), missing order (404), limits (429), temporary service problems (5xx). Production needs an active connected recipient account. Sandbox can create nonpayable orders but does not simulate successful payments or prepare real QR. Do not bypass these checks.

Deliver working server routes, frontend states (loading, pending, failed, success, expiry, retry), secure configuration instructions, and tests for unauthorized order access, tampered amount, duplicate callbacks/webhooks, API timeouts and failed payment. Ask me only for the stack or settings you cannot infer; do not ask me to paste secrets into chat. Do not claim live payments tested without a real authorized payment.

OpenAPI specification

Download OpenAPI JSON