Posting a Transaction
POST hidden form fields to /checkout/initiate (the customer's browser follows the redirect). Content type: application/x-www-form-urlencoded or multipart/form-data.
| Field | Required | Description |
|---|---|---|
amount | yes | Plain decimal, 2 dp, no separators — e.g. 50000.00 |
site_redirect_url | yes | Where we redirect back after payment (https) |
txn_ref | yes | Your unique transaction reference for this attempt |
hash | yes | HMAC-SHA256 of the fields (below), keyed with your live API key |
cust_name | yes | Customer full name (shown on the checkout) |
partner_id | yes | Your QOOP-Pay username (e.g. slotsystems) |
live_api_key | yes | Your live API key secret — also the HMAC key |
order_id | yes | Your order number; duplicates are declined |
Hash algorithm (contract v1)
message = amount|site_redirect_url|txn_ref|cust_name|partner_id|order_id
hash = HMAC_SHA256(key = live_api_key, message).toLowerCase() // lowercase hex// Node.js
import crypto from "crypto";
export function qoopayHash(p, liveApiKey) {
const message = [p.amount, p.site_redirect_url, p.txn_ref, p.cust_name, p.partner_id, p.order_id].join("|");
return crypto.createHmac("sha256", liveApiKey).update(message, "utf8").digest("hex");
}// PHP
function qoopay_hash(array $p, string $liveApiKey): string {
$message = implode("|", [$p["amount"], $p["site_redirect_url"], $p["txn_ref"],
$p["cust_name"], $p["partner_id"], $p["order_id"]]);
return hash_hmac("sha256", $message, $liveApiKey);
}Field order is fixed and values are used verbatim — no trimming or case folding. See the full worked example in
docs/hash-algorithm.md and the ready-made snippets in Plugins & Snippets.Failure modes at initiate
- Invalid key or hash → redirect back with
ResponseCode=11,err=true, description set. - Duplicate active
order_id→ same bounce;GET /api/v1/gettransactionreports02for that order.
Test keys
Merchants also hold a test secret (qpk_test_… prefix — live secrets start qpk_live_). Post it in the same live_api_key field and HMAC it exactly the same way: the whole gateway runs against test data — the payer's test balance is debited, the order is visible only to test keys, and test orders never touch live balances or settlement. Duplicate order_id checks are scoped per environment, so the same order number can be reused across live and test. Regenerate either secret from MerchantHub → Settings (shown once, stored hashed).
