REST API & Integration Documentation
Connect WHMCS, Kbilling, WooCommerce, or any custom PHP/Node.js website with your gateway.
Pass your secret API key via standard HTTP header: Authorization: Bearer <API_KEY>
Ready-to-use CryptoGatewayClient.php included in the codebase for zero-setup PHP integration.
Pre-built WHMCS payment module located in integrations/whmcs/ ready to upload.
/api/v1/invoicesCreates a new crypto invoice with automatic exchange rate conversion and dynamic network fee buffer. Returns a dedicated payment link.
Request Parameters (JSON Body)
| Field | Type | Required | Description |
|---|---|---|---|
| amount | number | Yes | USD price amount (e.g. 50.00). |
| invoice_number | string | Yes | Your WHMCS / panel invoice # (e.g. 10492) to track all paid & unpaid attempts. |
| domain | string | Optional | Authorized domain for this account (or sent via X-Client-Domain header). |
| order_id | string | Optional | Internal checkout order reference. |
| coin | string | No (default: USDT) | BNB, BTC, ETH, USDT, USDC, SOL, LTC, DOGE. |
| network | string | No (default: BSC) | BSC, SOLANA, ETHEREUM, BITCOIN, LITECOIN, DOGECOIN. |
| webhook_url | string | No | Endpoint that receives payment callbacks. |
| return_url | string | No | Redirect URL after client completes payment. |
curl -X POST "https://pay.yourdomain.com/api/v1/invoices" \
-H "Authorization: Bearer cg_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"amount": 49.99,
"currency": "USD",
"order_id": "ORD-10024",
"title": "Cloud Hosting Plan",
"customer_email": "client@example.com",
"coin": "USDT",
"network": "BSC",
"webhook_url": "https://yourdomain.com/api/crypto-webhook.php",
"return_url": "https://yourdomain.com/clientarea"
}'PHP & Custom Billing Panel (Kbilling) Integration
Include CryptoGatewayClient.php in your project to accept crypto payments in 5 lines of code:
<?php
require_once 'CryptoGatewayClient.php';
$client = new CryptoGatewayClient('https://pay.yourdomain.com', 'cg_live_your_api_key');
$invoice = $client->createInvoice([
'amount' => 50.00,
'order_id' => 'INV-1092',
'title' => 'Web Design Service',
'coin' => 'USDT',
'network' => 'BSC',
'webhook_url' => 'https://yoursite.com/webhook.php'
]);
// Redirect customer to the payment page
header('Location: ' . $invoice['data']['payment_url']);
exit;Webhook Signature Verification (HMAC-SHA256)
Every webhook sent by the gateway includes an X-Gateway-Signature header. Verify it to guarantee authenticity:
<?php
// Verify incoming HMAC-SHA256 signature
$rawBody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_GATEWAY_SIGNATURE'] ?? '';
$secret = 'whsec_your_webhook_secret';
$expected = hash_hmac('sha256', $rawBody, $secret);
if (!hash_equals($expected, $signature)) {
http_response_code(401);
die('Invalid signature');
}
$payload = json_decode($rawBody, true);
if ($payload['event'] === 'payment.completed') {
$orderId = $payload['order_id'];
$txHash = $payload['transactions'][0]['txHash'];
// Mark order paid in your database...
}WHMCS Gateway Module Setup (2 Minutes)
Copy the files inside integrations/whmcs/ to your WHMCS server directory:
modules/gateways/cryptogateway.phpmodules/gateways/callback/cryptogateway.php
Navigate to Setup > Payments > Payment Gateways > All Payment Gateways and activate Direct Crypto Payment Gateway.
Enter your Gateway URL, API Key, and Webhook Secret (available in your Wallet Settings tab). Save changes.