HTT Pay Merchant API
Collect PKR with Raast QR payments (payable from any Pakistani bank app, JazzCash or EasyPaisa) — in your own checkout (H2H) or on our hosted payment page — and send JazzCash / Easypaisa payouts from your balance. Check balance, query orders and receive signed status callbacks.
| Base URL | https://pay.httverse.com |
| Format | JSON over HTTPS |
| Support | support@httverse.com |
Quick start
- Get your account from HTT Pay. New merchants start in Testing mode.
- Merchant portal → API & Security: copy API Key and Secret, and add your server's public IP to the IP whitelist.
- Sign every request (see below). Test with
GET /api/v1/balanceandGET /api/v1/channels. - Create a QR payin with
POST /api/v1/payin/create, show the returnedqr_payloadas a QR code together with the exactpayable_amount. - Handle the callback at your
callback_urland reply with plain textsuccess.
What changed for existing integrations
| Before | Now |
|---|---|
Payin pushed an approval request to the customer's EasyPaisa / JazzCash number (channel + customer_account). |
Payins are QR only. POST /api/v1/payin/create returns qr_payload + payable_amount immediately; show them to the customer. channel / customer_account are still accepted but ignored. |
| EasyPaisa QR needed a second call with the payer number. | Not needed. /api/v1/payin/qr/submit-number still answers (returns the same QR) for old code. |
| Customer paid exactly the order amount. | Customer pays payable_amount: always whole rupees, up to 5 rupees above or below your amount (e.g. 499 for a 500 order). Your balance is still credited on your original amount minus fee. |
Payout fields: channel, customer_account. |
Same, or method / account. New required field: account_name (wallet holder name). Payouts are processed by our team and can take longer; the result comes by callback. |
Authentication, signatures, callbacks (format and success reply), balance and order query are unchanged.
Authentication & signature
Every /api/v1/* call needs these headers. GET requests are signed too (their body is empty).
| Header | Example | Description |
|---|---|---|
Content-Type | application/json | For POST requests |
X-API-KEY | hk_xxx | Your API key |
X-API-TIMESTAMP | 1780920000 | Unix seconds, valid for 5 minutes |
X-API-NONCE | 7f2b9e32c0f247a9 | Random unique string per request (max 64) |
X-SIGNATURE | lowercase hex | HMAC-SHA256 with your API secret |
BODY_HASH = SHA256(raw_request_body) // empty string for GET
STRING_TO_SIGN = METHOD + "|" + PATH + "|" + TIMESTAMP + "|" + NONCE + "|" + BODY_HASH
X-SIGNATURE = HMAC_SHA256(STRING_TO_SIGN, API_SECRET) PATH is only the URL path, e.g. /api/v1/payin/create — no domain, no query string, no trailing slash. Sign exactly the raw JSON string you send.
Testing vs Production
| Mode | Behaviour |
|---|---|
| testing | No real money. QR payins return a dummy qr_payload (TEST-QR-…) and succeed automatically; payouts succeed automatically and need no balance. Payloads include "test": true. |
| production | Real payments. Final callback comes after the payment is confirmed. Payouts need available balance. |
Order status
| Status | Meaning | Your action |
|---|---|---|
| PROCESSING | Created; QR shown / payout waiting for processing. | Wait for callback / query. |
| SUCCESS | Payment confirmed / payout sent. | Deliver service / mark paid. |
| FAILED | Not paid within the window, rejected or could not be processed. | Do not deliver. For payouts the reserved amount is returned to your balance. |
Fees: payin net_amount = requested_amount − fee_amount is credited to your balance. Payout gross_debit = amount + fee_amount is debited.
callback_status is about our callback delivery to you, not about the payment.
POST/api/v1/payin/create
H2H QR payin: you show the QR code in your own checkout. The QR is created immediately and is valid for 10 minutes (expires_in_seconds). It is a Raast QR: the customer can pay it from any bank app, JazzCash or EasyPaisa.
| Field | Req. | Description |
|---|---|---|
merchant_order_id | Yes | Your unique order ID (1-64: letters, digits, _ . -) |
amount | Yes | Decimal string, 100.00 to 50000.00 |
callback_url | Yes | HTTPS URL that returns plain text success |
customer_name | No | Payer label for your records |
idempotency_key | Recommended | Retry-safe key; reusing it returns the existing order (and its QR) |
payment_method | No | qr (default). Old values easypaisa / jazzcash / easypaisa_scan are accepted and treated as QR. |
Request
{
"merchant_order_id": "ORDER-100001",
"amount": "500.00",
"callback_url": "https://merchant.example.com/pay/callback",
"idempotency_key": "ORDER-100001"
} Response — HTTP 202
{
"ok": true,
"message": "QR order created. Show the QR and the exact payable_amount to the customer; final status comes by callback.",
"data": {
"type": "payin",
"platform_order_id": "HPIN20261026120000A1B2C3",
"merchant_order_id": "ORDER-100001",
"channel": "qr",
"payment_method": "qr",
"status": "PROCESSING",
"callback_status": "CALLBACK_PENDING",
"requested_amount": "500.00",
"payable_amount": "499.00",
"fee_amount": "35.00",
"net_amount": "465.00",
"qr_ready": true,
"qr_payload": "000201010211...",
"expires_at": "2026-10-26 12:10:00",
"expires_in_seconds": 600,
"next_action": "DISPLAY_QR_AND_WAIT_CALLBACK",
"integration_mode": "h2h",
"created_at": "2026-10-26 12:00:00"
}
} qr_payload | Render this exact string as a QR code (do not change it). |
payable_amount | Show it prominently: the customer must pay exactly this amount. |
expires_in_seconds | Count down on screen; the final result still comes from the callback / query. |
If the QR cannot be created the response has "status": "FAILED" and a message — create a new order to try again.
POST/api/v1/payin/page
Hosted payment page: redirect the customer to payment_url. There they press Pay with QR, see the QR and the exact amount, and the page shows the result.
The 10-minute QR window starts when the customer presses the button. Unopened links expire after 60 minutes (or expires_in_minutes).
Fields: merchant_order_id, amount, callback_url (required); return_url, description, expires_in_minutes (5–43200), idempotency_key (optional).
{
"ok": true,
"message": "Payment page created instantly.",
"data": {
"type": "payin",
"platform_order_id": "HPIN20261026123500D4E5F6",
"merchant_order_id": "PAGE-200001",
"status": "PROCESSING",
"integration_mode": "payment_page",
"payment_url": "https://pay.httverse.com/checkout.php?t=...",
"requested_amount": "1500.00",
"fee_amount": "105.00",
"net_amount": "1395.00"
}
} Payable amount & the QR window
- Each QR gets its own
payable_amountin whole rupees, at most 5 rupees above or below your amount (a 500.00 order may show 500, 499, 501, 498 …), so the payment can be matched. The amount is already filled in the QR; the customer must pay exactly that. Your accounting stays onrequested_amount. - Every QR payin can be paid for 10 minutes (
expires_in_seconds). If no matching payment arrives, the order becomes FAILED and you get a FAILED callback. - Payment confirmation usually takes about a minute. If a payment that arrived inside the window is confirmed a little later, the same order can still change to SUCCESS and you receive a SUCCESS callback. Allow FAILED → SUCCESS for payins and apply callbacks idempotently.
- Closing the browser does not matter — confirmation happens on our side.
POST/api/v1/payout/create
Send money from your available balance to a JazzCash or Easypaisa wallet. gross_debit is reserved immediately; on FAILED it is returned.
Payouts are processed manually and stay PROCESSING until done — never send a second payout for the same purpose while one is PROCESSING.
| Field | Req. | Description |
|---|---|---|
merchant_order_id | Yes | Your unique payout ID |
amount | Yes | Amount the receiver gets, 100.00 to 50000.00 |
method (or channel) | Yes | easypaisa or jazzcash |
account (or customer_account) | Yes | Wallet number 03XXXXXXXXX |
account_name (or customer_name) | Yes | Wallet holder name (max 120) |
callback_url | Yes | HTTPS URL that returns plain text success |
idempotency_key | Recommended | Retry-safe key |
{
"merchant_order_id": "PAYOUT-900001",
"amount": "1000.00",
"method": "jazzcash",
"account": "03001234567",
"account_name": "Ali Khan",
"callback_url": "https://merchant.example.com/pay/callback",
"idempotency_key": "PAYOUT-900001"
} {
"ok": true,
"message": "Request accepted for processing.",
"data": {
"type": "payout",
"platform_order_id": "HPOUT20261026124500G7H8I9",
"merchant_order_id": "PAYOUT-900001",
"channel": "jazzcash",
"status": "PROCESSING",
"requested_amount": "1000.00",
"fee_amount": "30.00",
"net_amount": "1000.00",
"gross_debit": "1030.00",
"customer_account": "03001234567",
"account_name": "Ali Khan"
}
} GET/api/v1/balance
{ "ok": true, "data": { "available_balance": "12000.00", "frozen_balance": "1030.00" } } available_balance: usable for payouts. frozen_balance: reserved for payouts in progress.
GET/api/v1/channels
What your account can do, with your fees.
{
"ok": true,
"data": [
{ "channel": "qr", "payment_method": "qr", "name": "QR payment", "payin": true, "payout": false, "h2h": true, "hosted": true,
"payin_fee_percent": "7.00", "payout_fee_percent": null, "min_amount": "100.00", "max_amount": "50000.00" },
{ "channel": "easypaisa", "payment_method": "easypaisa", "name": "Easypaisa", "payin": false, "payout": true,
"payin_fee_percent": null, "payout_fee_percent": "3.00", "min_amount": "100.00", "max_amount": "50000.00" },
{ "channel": "jazzcash", "payment_method": "jazzcash", "name": "JazzCash", "payin": false, "payout": true,
"payin_fee_percent": null, "payout_fee_percent": "3.00", "min_amount": "100.00", "max_amount": "50000.00" }
]
} GETOrder query
| Endpoint | Purpose |
|---|---|
GET /api/v1/orders/{platformOrderId} | Payin or payout by our order ID |
GET /api/v1/payin/{merchantOrderId} | Payin by your order ID |
GET /api/v1/payout/{merchantOrderId} | Payout by your order ID |
Returns the same data object as create (open QR payins include qr_payload again). 404 {"ok":false,"message":"Order not found."} if not yours / not found.
Callbacks
We POST JSON to your callback_url. Verify the signature, process once per event, and reply with plain text success (HTTP 200). Anything else is retried (1m, 5m, 15m, 30m, 1h … up to 24h).
| Header | Description |
|---|---|
X-HTTPAY-TIMESTAMP | Unix seconds |
X-HTTPAY-EVENT-ID | Unique per event — store it and ignore repeats |
X-HTTPAY-SIGNATURE | HMAC_SHA256(TIMESTAMP + "." + EVENT_ID + "." + raw_body, API_SECRET) |
X-HTTPAY-SIGNATURE-ALGORITHM | HMAC-SHA256 |
Payin SUCCESS
{
"type": "payin",
"platform_order_id": "HPIN20261026120000A1B2C3",
"merchant_order_id": "ORDER-100001",
"channel": "qr",
"payment_method": "qr",
"status": "SUCCESS",
"event": "ORDER_SUCCESS",
"message": "Order completed successfully.",
"requested_amount": "500.00",
"payable_amount": "499.00",
"fee_amount": "35.00",
"net_amount": "465.00",
"customer_account": null,
"processed_at": "2026-10-26 12:02:14"
} Other events: ORDER_SUBMITTED (accepted — not a payment; payment pages send "status": "PAYMENT_PAGE_CREATED" with payment_url) and
ORDER_FAILED ("status": "FAILED" with message). Payouts include gross_debit and account_name.
A payin can receive ORDER_FAILED and later ORDER_SUCCESS — treat SUCCESS as final.
PHP callback receiver
<?php
$apiSecret = 'YOUR_API_SECRET';
$raw = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_X_HTTPAY_TIMESTAMP'] ?? '';
$eventId = $_SERVER['HTTP_X_HTTPAY_EVENT_ID'] ?? '';
$received = $_SERVER['HTTP_X_HTTPAY_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $timestamp . '.' . $eventId . '.' . $raw, $apiSecret);
if ($timestamp === '' || $eventId === '' || !hash_equals($expected, $received)) {
http_response_code(401);
exit('invalid signature');
}
$data = json_decode($raw, true);
// Save $eventId; if already processed, just reply success.
if (($data['status'] ?? '') === 'SUCCESS') {
// mark order $data['merchant_order_id'] paid / deliver once (also if it was marked failed before)
} elseif (($data['status'] ?? '') === 'FAILED') {
// mark failed only if it is not already paid
}
header('Content-Type: text/plain');
echo 'success'; Errors
| HTTP | Message | Fix |
|---|---|---|
| 401 | Missing authentication headers. | Send all required headers. |
| 401 | Timestamp expired. | Sync server clock; timestamp must be within 5 minutes. |
| 401 | Invalid API key. | Wrong key or account disabled. |
| 401 | IP not whitelisted. | Add your server IP in the merchant portal. |
| 401 | Invalid signature. | Check method / path / timestamp / nonce / body hash / secret. |
| 401 | Nonce already used. | Use a new random nonce per request. |
| 422 | Invalid input. | See the errors object (e.g. account_name missing on payouts). |
| 422 | Duplicate merchant_order_id for this merchant. | Use a unique ID or an idempotency_key. |
| 422 | Insufficient available balance. | Payouts need balance ≥ gross_debit. |
| 422 | Payment provider is not available for your account. Contact support. | Temporary; contact support. |
| 202 + FAILED | e.g. "Too many payments of this amount right now. Please try again in a few minutes." | Temporary payin availability issue; try again later with a new order. |
| 404 | Order not found. | Check the ID. |
| 500 | Internal error. | Query the order first, then retry with the same idempotency_key. |
Retries & safety
merchant_order_idmust be unique per merchant. With the same non-emptyidempotency_keywe return the existing order instead of creating a new one.- On a network retry keep the same body,
merchant_order_idandidempotency_key, but use a new timestamp, nonce and signature. - After a timeout or HTTP 500, query the original order before creating anything new.
- Payouts: never send a second payout with a new order ID while the first one is PROCESSING or unknown.
- Treat PROCESSING as "not final", never as failed.
PHP: sign & create a QR payin
<?php
function pay_request(string $method, string $path, array $body = []): array {
$baseUrl = 'https://pay.httverse.com';
$apiKey = 'YOUR_API_KEY';
$apiSecret = 'YOUR_API_SECRET';
$rawBody = $method === 'GET' ? '' : json_encode($body, JSON_UNESCAPED_SLASHES);
$timestamp = (string) time();
$nonce = bin2hex(random_bytes(12));
$toSign = $method . '|' . $path . '|' . $timestamp . '|' . $nonce . '|' . hash('sha256', $rawBody);
$signature = hash_hmac('sha256', $toSign, $apiSecret);
$ch = curl_init($baseUrl . $path);
$opts = [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
'X-API-KEY: ' . $apiKey,
'X-API-TIMESTAMP: ' . $timestamp,
'X-API-NONCE: ' . $nonce,
'X-SIGNATURE: ' . $signature,
],
];
if ($method !== 'GET') {
$opts[CURLOPT_POSTFIELDS] = $rawBody;
}
curl_setopt_array($ch, $opts);
$response = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return ['http_code' => $code, 'json' => json_decode((string) $response, true)];
}
$r = pay_request('POST', '/api/v1/payin/create', [
'merchant_order_id' => 'ORDER-' . time(),
'amount' => '500.00',
'callback_url' => 'https://merchant.example.com/pay/callback',
]);
$qr = $r['json']['data']['qr_payload'] ?? null; // render as QR, unchanged
$payable = $r['json']['data']['payable_amount'] ?? null; // show: "Pay exactly PKR ..." Browser: render the QR
<div id="qr"></div>
<p>Pay exactly PKR <span id="amt"></span></p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
<script>
new QRCode(document.getElementById("qr"), { text: QR_PAYLOAD_FROM_YOUR_SERVER, width: 240, height: 240 });
document.getElementById("amt").textContent = PAYABLE_AMOUNT_FROM_YOUR_SERVER;
// poll YOUR server, which waits for our callback or calls GET /api/v1/orders/{id}
</script> Node.js: signature helper
import crypto from 'crypto';
function signRequest(method, path, rawBody, apiSecret) {
const timestamp = Math.floor(Date.now() / 1000).toString();
const nonce = crypto.randomBytes(12).toString('hex');
const bodyHash = crypto.createHash('sha256').update(rawBody || '').digest('hex');
const signature = crypto.createHmac('sha256', apiSecret)
.update(`${method}|${path}|${timestamp}|${nonce}|${bodyHash}`).digest('hex');
return { timestamp, nonce, signature };
} Go-live checklist
| Security | Secret on your server only; exact server IP whitelisted; HTTPS callback URL; server clock synced (NTP). |
| Signing | Exact raw body; timestamp in seconds; new nonce per request; lowercase hex signature. |
| QR payins | Render the exact qr_payload; show the exact payable_amount and a countdown from expires_in_seconds; wait for the final status. |
| Callbacks | Verify signature, process idempotently, reply success quickly; allow FAILED → SUCCESS for payins. |
| Payouts | Send account_name; query uncertain orders; never duplicate a PROCESSING payout. |
| Testing | Run all flows in Testing mode, then ask HTT Pay to switch your account to Production. |