API reference
REST API
There are three endpoints: create an order, read it, and cancel it. Requests and responses are JSON, and you authenticate with your merchant API key.
Base URL & format #
- Send request bodies as
application/json. Form-encoded bodies (application/x-www-form-urlencoded) also work. A body can be up to 1 MB. - Successful responses look like
{"success": true, "data": {…}}. - Error responses look like
{"error": "message"}. They have nosuccessfield, so check the HTTP status code. - Timestamps are ISO 8601 in UTC, for example
2026-10-25T10:02:41.000Z. Amounts are JSON numbers. - Use HTTPS. On production, plain-HTTP requests get a
301redirect, and many HTTP clients drop the body and theAuthorizationheader when they follow it.
Authentication #
Put your API key from Dashboard → Developer in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEY
- The key is 54 lowercase hex characters. It has no prefix such as
pk_orlive_, and there are no separate test keys. - PayerNex stores only a SHA-256 hash of the key. Regenerate API Key in the dashboard makes the old key stop working immediately.
- Write
Bearerexactly like that: capital B, then one space. Query-string and body keys are not accepted on these endpoints. - Only call the API from your server. Never put the key in browser or mobile-app code.
| Status | Body | When |
|---|---|---|
401 | {"error":"API key required"} | No Authorization header. |
401 | {"error":"Invalid API key"} | The key doesn't match any account (for example, it was regenerated). |
403 | {"error":"Account suspended"} | The merchant account is disabled. |
Test mode #
Create a test key in Dashboard → Developer and use it instead of your live key while you build. It starts with test_ and works on the same endpoints.
- Orders created with it have
"test": trueand open a test checkout with two buttons — Simulate successful payment and Simulate expiry. No real gateway is shown and no money moves. - Simulating a payment marks the order paid and sends your IPN and webhook endpoint events exactly like a real payment, with
"test": truein the body. Treat test notifications as test data in your system. - Test orders need no active subscription and don't count toward your plan's monthly order limit. They are listed under Dashboard → Orders → Test orders, never mixed with live orders or stats.
- Each key only sees its own orders: a live key gets
404for a testorder_refand the other way round.
Rate limits #
Each client IP address can make 60 requests per 60-second window. The limit covers every /api/* path together, not each endpoint separately. Each response carries the standard RateLimit-* headers. When you go over the limit you get:
{ "error": "Too many requests, please slow down" }
Wait for the window to reset (the Retry-After header gives the seconds) and try again. Your plan also limits how many orders you can create each calendar month (see errors).
Errors #
| Status | Error message | Endpoint · cause |
|---|---|---|
401 | API key required / Invalid API key | All · see authentication |
403 | Account suspended | All · account disabled |
403 | Merchant subscription expired. Please renew your plan. | create-order · no active subscription |
404 | Order not found | get / cancel · unknown order_ref, or it belongs to another merchant |
404 | Not found | Any unknown /api/… path |
422 | Valid amount is required (0.01 - 1,000,000) | create-order · amount missing, not a number, ≤ 0 or > 1,000,000 |
422 | Invalid currency. Supported: USDT, BTC, ETH, BNB, BUSD, PKR, USD | create-order · currency isn't one of those |
422 | ipn_url must be an absolute http(s) URL (max 500 characters) (same for success_url, cancel_url) | create-order · a URL field isn't an absolute http:// or https:// URL |
422 | local_amount and customer_balance must be numbers | create-order · one of those fields isn't numeric |
422 | Only pending orders can be cancelled | cancel-order · order isn't pending |
429 | Monthly order limit reached (+ current, max) | create-order · plan's monthly order quota used up (counted from the 1st of the month) |
429 | Too many requests, please slow down | All · rate limit |
500 | Failed to create order / Failed to retrieve order / Failed to cancel order | Unexpected server error, or a field value the database can't store (see the length limits below) |
{ "error": "Monthly order limit reached", "current": 500, "max": 500 }
Create an order #
Creates a pending order that expires in 30 minutes and returns the hosted checkout_url to send the buyer to. Your account needs an active subscription and at least one gateway.
Body parameters
| Field | Type | Description |
|---|---|---|
amountrequired | number | string | Amount to charge, in currency. Must be greater than 0 and at most 1000000, with up to 8 decimals. Numeric strings such as "25.00" work too. With a blockchain (TRC20/BEP20) gateway, PayerNex changes the decimals so each order has a unique amount. See amounts. |
currencyoptional | string | One of USDT, BTC, ETH, BNB, BUSD, PKR, USD. The default is USDT. Case doesn't matter; it is stored in uppercase. |
customer_idoptional | string ≤ 100 | Your own reference for the buyer or invoice. It comes back in the order and the webhook. |
customer_emailoptional | string ≤ 255 | Buyer's email address. It comes back in the order and the webhook. |
descriptionoptional | string ≤ 500 | Free text such as Invoice #1042. It comes back in the order and the webhook. The official plugins put #<invoice id> here and read it back from the webhook. |
ipn_urloptional | URL ≤ 500 | Webhook URL for this order only. It takes priority over your account Callback URL. See which URL is notified. |
success_urloptional | URL ≤ 500 | Where the buyer goes once the order is paid. Use an absolute https:// URL. |
cancel_urloptional | URL ≤ 500 | Used for the checkout's "Return to site" link, and where the buyer is sent if the order expires. Use an absolute https:// URL. |
local_amountoptional | number (2 dp) | The same price in the buyer's local currency, for example the PKR amount for a bank transfer. The checkout shows it to the buyer. |
local_currencyoptional | string ≤ 10 | Currency code of local_amount, for example PKR. If you send it, the checkout uses it instead of currency to decide which gateways to show, based on each gateway's currency rules. |
gateway_idoptional | integer | ID of one of your active gateways to attach to the order first. If it isn't found or isn't active, PayerNex silently uses your first active gateway. The buyer can still pick from all your eligible gateways on the checkout. |
customer_balanceoptional | number (2 dp) | The buyer's current balance on your site. The checkout shows it in a "Current Balance" card, which is useful for wallet top-ups. |
source_websiteoptional | string | The website the order came from. It is stored for your reference and cut to 255 characters. |
customer_refoptional | string ≤ 64 | Your ID for the buyer (for example their account ID). On a card payment it is added to the Stripe PaymentIntent metadata as customer_ref, so you can find and filter it in Stripe. Longer values are rejected with 422. |
customer_countryoptional | string (ISO-2) | Country of the buyer's verified ID document, for example PK. On a card payment it is added to the PaymentIntent metadata as kyc_country for your own Stripe Radar rules. Anything other than two letters is rejected with 422. |
Length limits: text fields longer than their limit are cut to fit (customer_id 100, customer_email 255, description 500, source_website 255 characters). URL fields longer than 500 characters are rejected with 422. A gateway_id that isn't a number is ignored.
curl -X POST https://payernex.com/api/v1/create-order \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 25.00,
"currency": "USDT",
"customer_id": "user_1042",
"customer_email": "[email protected]",
"description": "Invoice #1042",
"ipn_url": "https://your-site.com/payernex/webhook",
"success_url": "https://your-site.com/orders/1042/thanks",
"cancel_url": "https://your-site.com/orders/1042",
"local_amount": 7000,
"local_currency": "PKR"
}'
<?php
function payernex_request(string $method, string $path, ?array $body = null): array
{
$ch = curl_init('https://payernex.com' . $path);
$headers = [
'Authorization: Bearer ' . getenv('PAYERNEX_API_KEY'),
'Accept: application/json',
];
if ($body !== null) {
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
}
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => $headers,
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$json = json_decode((string) $raw, true) ?: [];
if ($status < 200 || $status >= 300) {
throw new RuntimeException('PayerNex ' . $status . ': ' . ($json['error'] ?? 'request failed'));
}
return $json['data'];
}
$order = payernex_request('POST', '/api/v1/create-order', [
'amount' => 25.00,
'currency' => 'USDT',
'customer_id' => 'user_1042',
'customer_email' => '[email protected]',
'description' => 'Invoice #1042',
'ipn_url' => 'https://your-site.com/payernex/webhook',
'success_url' => 'https://your-site.com/orders/1042/thanks',
'cancel_url' => 'https://your-site.com/orders/1042',
'local_amount' => 7000,
'local_currency' => 'PKR',
]);
// Persist $order['order_ref'] against invoice #1042 BEFORE redirecting.
header('Location: ' . $order['checkout_url']);
exit;
// Node.js 18+ (built-in fetch)
const BASE = 'https://payernex.com';
async function payernex(method, path, body) {
const res = await fetch(BASE + path, {
method,
headers: {
Authorization: `Bearer ${process.env.PAYERNEX_API_KEY}`,
Accept: 'application/json',
...(body ? { 'Content-Type': 'application/json' } : {}),
},
body: body ? JSON.stringify(body) : undefined,
});
const json = await res.json().catch(() => ({}));
if (!res.ok) throw new Error(`PayerNex ${res.status}: ${json.error || 'request failed'}`);
return json.data;
}
async function startCheckout() {
const order = await payernex('POST', '/api/v1/create-order', {
amount: 25.0,
currency: 'USDT',
customer_id: 'user_1042',
customer_email: '[email protected]',
description: 'Invoice #1042',
ipn_url: 'https://your-site.com/payernex/webhook',
success_url: 'https://your-site.com/orders/1042/thanks',
cancel_url: 'https://your-site.com/orders/1042',
local_amount: 7000,
local_currency: 'PKR',
});
// Persist order.order_ref against invoice #1042 BEFORE redirecting.
return order.checkout_url;
}
module.exports = { payernex, startCheckout };
Response 201 Created
{
"success": true,
"data": {
"order_ref": "ORD-9F2C61D04B7A3E58",
"note_code": "48213",
"amount": 25,
"currency": "USDT",
"status": "pending",
"checkout_url": "https://payernex.com/checkout/…",
"expires_at": "2026-10-25T10:32:41.000Z"
}
}
| Field | Type | Description |
|---|---|---|
order_ref | string | Order ID: ORD- + 16 uppercase hex characters. Save it so you can look up or cancel the order. |
note_code | string | 6-digit code (100000–999999) the buyer enters as the Binance Pay note/memo. The checkout shows it to them. |
amount | number | The amount the buyer must pay. It can differ from the amount you sent when a blockchain gateway is attached. |
currency | string | The order currency, exactly as stored. |
status | string | Always pending for a new order. |
checkout_url | string | Hosted payment page for this order. The ID in it is encrypted, so the URL can't be guessed. |
expires_at | string | Creation time + 30 minutes. Some card or voucher gateways extend it after the buyer picks them. |
wallet_address, network, token, gateway_type | string | Only when the attached gateway is a blockchain wallet. These are the receiving address, the network (trc20, bep20, erc20, polygon, base, arbitrum or solana), the token the buyer must send (USDT or USDC) and "blockchain". |
Retrieve an order #
Returns one of your orders. Use it to check a webhook before you fulfil an order, or to poll if you missed a webhook. It returns 404 Order not found if the order doesn't exist or belongs to another merchant.
curl https://payernex.com/api/v1/order/ORD-9F2C61D04B7A3E58 \
-H "Authorization: Bearer YOUR_API_KEY"
<?php
// payernex_request() is defined in the create-order example above.
$order = payernex_request('GET', '/api/v1/order/' . rawurlencode('ORD-9F2C61D04B7A3E58'));
if ($order['status'] === 'paid') {
// Fulfil using $order['paid_amount'] / $order['paid_currency'].
}
// payernex() is defined in the create-order example above.
async function isPaid(orderRef) {
const order = await payernex('GET', `/api/v1/order/${encodeURIComponent(orderRef)}`);
return order.status === 'paid';
}
{
"success": true,
"data": {
"order_ref": "ORD-9F2C61D04B7A3E58",
"note_code": "48213",
"amount": 25,
"paid_amount": 25,
"paid_currency": "USDT",
"currency": "USDT",
"status": "paid",
"customer_id": "user_1042",
"customer_email": "[email protected]",
"description": "Invoice #1042",
"fee_charged": 0,
"paid_at": "2026-10-25T10:14:03.000Z",
"expires_at": "2026-10-25T10:32:41.000Z",
"created_at": "2026-10-25T10:02:41.000Z"
}
}
An order paid by card (Stripe) also has card and dispute:
"card": {
"brand": "visa", "last4": "4242", "country": "PK", "funding": "debit", "wallet": null,
"three_d_secure": { "result": "authenticated", "version": "2.2.0" },
"liability_shift": true, "risk_level": "normal", "risk_score": 12, "cvc_check": "pass"
},
"dispute": null
| Field | Type | Description |
|---|---|---|
paid_amount | number | null | The amount actually received, in paid_currency. It is null until a payment is detected. It can be in a different currency from amount, for example PKR for a bank transfer on a USDT order. |
paid_currency | string | null | Currency of paid_amount. |
status | string | See order statuses. |
customer_id, customer_email, description | string | null | The values you sent when you created the order. |
fee_charged | number | Fee PayerNex recorded for this order. It is usually 0. |
paid_at | string | null | When the payment was detected or approved. |
expires_at, created_at | string | Current expiry time and creation time. |
card | object | null | Card orders only. See card payments. null until a card payment is received. |
dispute | object | null | Card orders only. The latest dispute (chargeback): status, reason, amount, currency, evidence_due_by, created_at, or null. |
failure_reason | string | Only on a failed card order, for example card not authenticated by the bank (3D Secure). |
The order object has no transaction_id. The payment reference (Binance order number, transaction hash or manual transaction ID) is only in the webhook payload.
Card payments & fraud protection #
Card payments go through your own Stripe account. Two settings on each Stripe gateway (Payment Gateways → Edit → Configuration), both on by default, protect you from chargeback fraud:
- Require 3D Secure on card payments: every card payment asks the card's bank to confirm the cardholder (OTP or bank app). When the bank authenticates the payment, a fraud dispute ("unauthorized", "not recognised") is the card bank's liability under the card network rules, not yours.
- Only accept 3D Secure authenticated card payments: if a card payment still succeeds without authentication, PayerNex refunds it in full, sets the order to
failedand sends nopayment.completedwebhook. Apple Pay and Google Pay count as authenticated (the buyer's device confirms them).
card field | Type | Description |
|---|---|---|
brand, last4 | string | Card brand (visa, mastercard…) and last four digits. The full card number is never stored or sent. |
country | string | null | ISO-2 country of the card's issuing bank. |
funding | string | credit, debit, prepaid or unknown. |
wallet | string | null | apple_pay, google_pay, another wallet type, or null. |
three_d_secure | object | null | result (authenticated, attempt_acknowledged, not_supported, failed…) and version. null when no 3D Secure ran. |
liability_shift | boolean | true when 3D Secure was authenticated or attempt_acknowledged, or the payment came from Apple Pay / Google Pay. |
risk_level, risk_score | string, number | null | Stripe Radar's assessment of the charge (risk_score only with Radar for Fraud Teams). |
cvc_check | string | null | pass, fail, unavailable or unchecked. |
Stripe Radar rules with your buyer's KYC country
Send customer_country (the country of the buyer's verified ID) and customer_ref with create-order. They reach the PaymentIntent metadata as kyc_country and customer_ref. In your Stripe dashboard (Radar → Rules) you can then add, for example:
Review if :card_country: != ::kyc_country::
Block if :card_funding: = 'prepaid'
The first sends a card from another country than the buyer's ID to manual review; the second blocks prepaid cards. PayerNex only passes these values on to Stripe and never uses them for anything else.
Disputes are reported with the payment.disputed webhook and the order's dispute field. Add charge.dispute.created and charge.dispute.closed to the events of your Stripe webhook endpoint so PayerNex hears about them.
List orders #
Returns your orders, newest first, in the same shape as Retrieve an order. A test key lists only test orders.
| Query parameter | Type | Description |
|---|---|---|
status | string | Only orders with this status: pending, paid, manual_review, rejected, expired or cancelled. |
created_from, created_to | string | ISO 8601 date or date-time. Both ends are inclusive. |
limit | integer | 1–100. Default 20. |
before | string | To get the next page, pass the next_before value from the previous page. |
curl "https://payernex.com/api/v1/orders?status=paid&limit=50" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"data": {
"orders": [ { "order_ref": "ORD-9F2C61D04B7A3E58", "status": "paid", "amount": 25, … } ],
"has_more": true,
"next_before": "ORD-1B07E4A2C9D35F60"
}
}
Cancel an order #
Moves a pending order to cancelled. No body is needed. If the order is in any other status you get 422 Only pending orders can be cancelled. An unknown order_ref returns 404.
curl -X POST https://payernex.com/api/v1/cancel-order/ORD-9F2C61D04B7A3E58 \
-H "Authorization: Bearer YOUR_API_KEY"
<?php
// payernex_request() is defined in the create-order example above.
$result = payernex_request('POST', '/api/v1/cancel-order/' . rawurlencode('ORD-9F2C61D04B7A3E58'));
echo $result['status']; // "cancelled"
// payernex() is defined in the create-order example above.
async function cancel(orderRef) {
const result = await payernex('POST', `/api/v1/cancel-order/${encodeURIComponent(orderRef)}`);
return result.status; // "cancelled"
}
{
"success": true,
"data": {
"order_ref": "ORD-9F2C61D04B7A3E58",
"status": "cancelled",
"message": "Order cancelled successfully"
}
}
A cancelled or expired order can still become paid. If a buyer has already started paying through a card or global gateway (Stripe, Yoco or another connected gateway) and the money arrives later, PayerNex still marks the order paid and sends the webhook. Always honour a verified paid webhook.
Refunds #
Refunds a paid order through the gateway that took the payment. Available for Stripe payments made on your own Stripe gateway; for bank transfers, Binance and crypto, send the money back from your own account. Refunds are in the currency actually charged on the card.
| Field | Type | Description |
|---|---|---|
order_refrequired | string | The order to refund. |
amountoptional | number | Amount to refund in the charged currency. Leave it out to refund everything still refundable. Partial refunds can be repeated until the total is used up. |
reasonoptional | string ≤ 255 | Shown in your dashboard and in the webhook. |
idempotency_keyoptional | string ≤ 64 | Send the same key when retrying; PayerNex returns the first refund instead of creating another (HTTP 200). Reusing a key for a different order returns 409. |
curl -X POST https://payernex.com/api/v1/refunds \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"order_ref":"ORD-9F2C61D04B7A3E58","amount":10,"reason":"Partial refund","idempotency_key":"refund-1042-1"}'
<?php
// payernex_request() is defined in the create-order example above.
$refund = payernex_request('POST', '/api/v1/refunds', [
'order_ref' => 'ORD-9F2C61D04B7A3E58',
'amount' => 10,
'reason' => 'Partial refund',
'idempotency_key' => 'refund-1042-1',
]);
echo $refund['status']; // "succeeded" or "pending"
// payernex() is defined in the create-order example above.
const refund = await payernex('POST', '/api/v1/refunds', {
order_ref: 'ORD-9F2C61D04B7A3E58',
amount: 10,
reason: 'Partial refund',
idempotency_key: 'refund-1042-1',
});
console.log(refund.status); // "succeeded" or "pending"
{
"success": true,
"data": {
"order_ref": "ORD-9F2C61D04B7A3E58",
"refund_id": 31,
"amount": 10,
"currency": "EUR",
"status": "succeeded",
"reason": "Partial refund",
"error": null,
"created_at": "2026-10-25T11:02:41.000Z"
}
}
status is succeeded, pending (the bank is still processing it) or failed (HTTP 502, with Stripe's reason in error). Errors you can fix return 422, for example Only paid orders can be refunded, You can refund at most 15.00 EUR or This order has already been fully refunded. A successful or pending refund also sends the order.refunded webhook event.
List refunds
Returns {"success": true, "data": {"order_ref": "…", "refunds": [ … ]}} with up to 100 refunds for the order, newest first, in the same shape as above.
Order statuses #
| Status | Meaning | Webhook? |
|---|---|---|
| pending | Created and waiting for payment. Every order starts here. | No |
| paid | Payment confirmed. PayerNex matched it automatically, the merchant approved it, or the merchant entered a manual transaction ID in the dashboard. | Yes. This is the only status that sends one. |
| manual_review | A payment was found but the amount didn't match closely enough. Binance Pay and connected gateways allow 1%; blockchain allows 0.001. The merchant approves it (→ paid, webhook sent) or rejects it (→ rejected) in the dashboard. | No. It is sent on approval. |
| rejected | The merchant rejected a manual_review payment. Final. | No |
| cancelled | Cancelled through cancel-order. Only pending orders can be cancelled. | No |
| expired | Still pending after expires_at. A background job expires these, and so does the checkout page the next time it checks the status. | No |
| failed | A card payment was refused after it went through (for example not authenticated by 3D Secure while strict mode is on) and refunded in full. See failure_reason. Final. | No |
Amounts & currencies #
- Supported
currencyvalues:USDT(default),BTC,ETH,BNB,BUSD,PKR,USD. Case doesn't matter. - Local amount: for bank transfers, also send
local_amountandlocal_currency(for example the store total in PKR) so the buyer sees the amount they actually need to send. Without them, the checkout converts the order amount to PKR itself for bank gateways. - Blockchain gateways (TRC20/BEP20 USDT): on-chain payments carry no memo, so PayerNex matches them by exact amount. When the order's gateway is a blockchain wallet, PayerNex keeps your amount to 3 decimals and adds 0.001–0.999 so no two pending orders share an amount. For example,
25might become25.417. The buyer must send exactly theamountin the response. - Binance Pay: the buyer enters the
note_codeas the payment note. A payment within 1% of the amount is accepted automatically. Anything else goes tomanual_review. - What was received: check
paid_amountandpaid_currency, notamount. A bank payment on a USDT order is recorded in the bank's currency, for example PKR.
Retries & duplicates #
The API has no idempotency keys. Every successful create-order call creates a new order with a new order_ref. To avoid duplicates:
- Store the
order_refagainst your invoice before you redirect the buyer, and reuse it while it is stillpendingand not expired. - If a create call times out, a duplicate does no harm. An unpaid order simply expires after 30 minutes, or you can cancel it.
GETandcancel-orderare safe to retry. Cancelling twice returns422the second time.
Hosted checkout #
- The buyer opens
checkout_urland sees every active gateway on your account, plus gateways other merchants have shared with you. Gateways are filtered by their currency rules againstlocal_currency(orcurrency), and card gateways are hidden when the amount is below their minimum charge. - The page shows a countdown to
expires_atand updates on its own when the payment is confirmed. - When the order is
paid, the buyer is redirected tosuccess_url. When it isexpired, the page shows a "Return to site" link tocancel_urland redirects there after 5 seconds. - A redirect to
success_urldoesn't prove payment, because anyone can open that URL. Fulfil orders only from the verified webhook orGET /api/v1/order/{order_ref}.
Express Wallet #
Express Wallet gives each of your customers one permanent crypto deposit address. The customer can send any amount of USDT or USDC at any time, without an order, and PayerNex tells your site who paid and how much. Use it for "add funds" or wallet top-ups. Funds are swept automatically to the settlement wallet you set in Payments → Express Wallet.
The address is a smart-contract (CREATE2) address with no private key. Funds sent to it can only be forwarded to your settlement wallet. It is the same address on every EVM network you enable (BNB Smart Chain, Polygon, Base, Arbitrum, OP Mainnet, Ethereum).
Create or fetch a customer address
Idempotent: the same merchant_client_id always returns the same address. Call it whenever the customer opens your "add funds" page. Use your live API key; the sandbox key is refused because the addresses are real.
| Field | Type | Description |
|---|---|---|
merchant_client_idrequired | string ≤ 100 | Your stable customer ID (user ID or username). Deposits are credited to this ID. |
merchant_client_emailoptional | string | Shown in your dashboard. |
merchant_client_nameoptional | string | Shown in your dashboard. |
ipn_urloptional | URL | Where express_wallet.paid is POSTed for this customer. Send it on every call. To receive all deposits in one place, also subscribe a webhook endpoint to express_wallet.paid. |
success_urloptional | URL | The hosted page returns here a few seconds after a deposit (when not in an iframe). |
fail_urloptional | URL | Stored for your reference. |
curl -X POST https://payernex.com/api/v1/express_wallet \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"merchant_client_id":"1042","merchant_client_email":"[email protected]","merchant_client_name":"Jane Smith","ipn_url":"https://your-site.com/payernex/express-ipn"}'
<?php
// payernex_request() is defined in the create-order example above.
$res = payernex_request('POST', '/api/v1/express_wallet', [
'merchant_client_id' => (string) $userId,
'merchant_client_email' => $email,
'merchant_client_name' => $name,
'ipn_url' => 'https://your-site.com/payernex/express-ipn',
]);
$address = $res['data']['address']; // show with a QR, or
$page = $res['data']['order_url']; // open in an iframe or popup
// payernex() is defined in the create-order example above.
const res = await payernex('POST', '/api/v1/express_wallet', {
merchant_client_id: String(user.id),
merchant_client_email: user.email,
merchant_client_name: user.name,
ipn_url: 'https://your-site.com/payernex/express-ipn',
});
console.log(res.data.address, res.data.order_url);
{
"status": "success",
"data": {
"merchant_client_id": "1042",
"address": "0x67BA74348b412A8F4493FDD63eaD9C5Ea5b10Bf0",
"networks": [
{ "network": "bsc", "name": "Binance [BEP-20]", "address": "0x67BA…0Bf0", "tokens": ["USDT", "USDC"] }
],
"min_deposit": 10,
"fee": { "percent": 0, "fixed": 0.1 },
"order_url": "https://payernex.com/express/3f9c…"
}
}
order_url is a ready-made page (coin and network picker, QR, address, live "payment received" state). It can be embedded in an <iframe>; it then sends window.postMessage({type: "payernex:express_wallet.paid", deposit_id, amount, token, credited_amount}) to the parent page when a deposit arrives, and {type: "payernex:express_wallet.close"} when the customer presses Back. Errors: 403 plan does not include Express Wallet, 409 settlement wallet not set up, 422 invalid field.
The express_wallet.paid notification
Sent to the customer's ipn_url once per deposit, after the blockchain confirms it, and also to webhook endpoints subscribed to express_wallet.paid. Retried for about 13 hours until you answer 2xx. Headers: X-Signature (and the same value in X-PayerNex-Signature) = hex HMAC-SHA256 of the raw body with your webhook secret, and X-Webhook-Event: express_wallet.paid.
{
"id": "evt_ew_581",
"type": "express_wallet.paid",
"created_at": "2026-11-14T08:25:00.640Z",
"data": {
"deposit_id": 581,
"merchant_client_id": "1042",
"customer_name": "Jane Smith",
"customer_email": "[email protected]",
"network": "bsc",
"network_name": "Binance [BEP-20]",
"token": "USDT",
"amount": "50",
"fee": "0.10",
"credited_amount": "49.90",
"currency": "USD",
"address": "0x67BA74348b412A8F4493FDD63eaD9C5Ea5b10Bf0",
"tx_hash": "0x21fc…954f",
"log_index": 0,
"block_number": "68213377",
"from": "0x8894…",
"explorer_url": "https://bscscan.com/tx/0x21fc…954f",
"status": "credited"
}
}
- Verify the signature over the raw body before parsing it.
- Credit
credited_amount(USD) tomerchant_client_id.feeis the customer fee you set;amountis what arrived on-chain. - Use
deposit_idas the idempotency key: the same deposit can be delivered more than once. Never credit it twice. - Optionally confirm it first with
GET /api/v1/express-wallet/deposits/{deposit_id}.
Read deposits
Use since_id to catch up on anything a missed notification did not deliver: keep the highest deposit_id you processed and ask for newer ones. Deposits below your minimum have status: "dust" and are not credited (the funds still reach your wallet).