Docs · API reference

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 #

https://payernex.com/api/v1
  • 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 no success field, 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 301 redirect, and many HTTP clients drop the body and the Authorization header when they follow it.

Authentication #

Put your API key from Dashboard → Developer in the Authorization header of every request:

Header
Authorization: Bearer YOUR_API_KEY
  • The key is 54 lowercase hex characters. It has no prefix such as pk_ or live_, 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 Bearer exactly 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.
StatusBodyWhen
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": true and 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": true in 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 404 for a test order_ref and 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:

Response · 429 Too Many Requests
{ "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 #

StatusError messageEndpoint · cause
401API key required / Invalid API keyAll · see authentication
403Account suspendedAll · account disabled
403Merchant subscription expired. Please renew your plan.create-order · no active subscription
404Order not foundget / cancel · unknown order_ref, or it belongs to another merchant
404Not foundAny unknown /api/… path
422Valid amount is required (0.01 - 1,000,000)create-order · amount missing, not a number, ≤ 0 or > 1,000,000
422Invalid currency. Supported: USDT, BTC, ETH, BNB, BUSD, PKR, USDcreate-order · currency isn't one of those
422ipn_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
422local_amount and customer_balance must be numberscreate-order · one of those fields isn't numeric
422Only pending orders can be cancelledcancel-order · order isn't pending
429Monthly order limit reached (+ current, max)create-order · plan's monthly order quota used up (counted from the 1st of the month)
429Too many requests, please slow downAll · rate limit
500Failed to create order / Failed to retrieve order / Failed to cancel orderUnexpected server error, or a field value the database can't store (see the length limits below)
Example · 429 monthly limit
{ "error": "Monthly order limit reached", "current": 500, "max": 500 }

Create an order #

POST/api/v1/create-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

FieldTypeDescription
amountrequirednumber | stringAmount 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.
currencyoptionalstringOne of USDT, BTC, ETH, BNB, BUSD, PKR, USD. The default is USDT. Case doesn't matter; it is stored in uppercase.
customer_idoptionalstring ≤ 100Your own reference for the buyer or invoice. It comes back in the order and the webhook.
customer_emailoptionalstring ≤ 255Buyer's email address. It comes back in the order and the webhook.
descriptionoptionalstring ≤ 500Free 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_urloptionalURL ≤ 500Webhook URL for this order only. It takes priority over your account Callback URL. See which URL is notified.
success_urloptionalURL ≤ 500Where the buyer goes once the order is paid. Use an absolute https:// URL.
cancel_urloptionalURL ≤ 500Used for the checkout's "Return to site" link, and where the buyer is sent if the order expires. Use an absolute https:// URL.
local_amountoptionalnumber (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_currencyoptionalstring ≤ 10Currency 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_idoptionalintegerID 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_balanceoptionalnumber (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_websiteoptionalstringThe website the order came from. It is stored for your reference and cut to 255 characters.
customer_refoptionalstring ≤ 64Your 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_countryoptionalstring (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"
  }'

Response 201 Created

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"
  }
}
FieldTypeDescription
order_refstringOrder ID: ORD- + 16 uppercase hex characters. Save it so you can look up or cancel the order.
note_codestring6-digit code (100000–999999) the buyer enters as the Binance Pay note/memo. The checkout shows it to them.
amountnumberThe amount the buyer must pay. It can differ from the amount you sent when a blockchain gateway is attached.
currencystringThe order currency, exactly as stored.
statusstringAlways pending for a new order.
checkout_urlstringHosted payment page for this order. The ID in it is encrypted, so the URL can't be guessed.
expires_atstringCreation time + 30 minutes. Some card or voucher gateways extend it after the buyer picks them.
wallet_address, network, token, gateway_typestringOnly 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 #

GET/api/v1/order/{order_ref}

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"
Response · 200 OK
{
  "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 order · extra fields
"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
FieldTypeDescription
paid_amountnumber | nullThe 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_currencystring | nullCurrency of paid_amount.
statusstringSee order statuses.
customer_id, customer_email, descriptionstring | nullThe values you sent when you created the order.
fee_chargednumberFee PayerNex recorded for this order. It is usually 0.
paid_atstring | nullWhen the payment was detected or approved.
expires_at, created_atstringCurrent expiry time and creation time.
cardobject | nullCard orders only. See card payments. null until a card payment is received.
disputeobject | nullCard orders only. The latest dispute (chargeback): status, reason, amount, currency, evidence_due_by, created_at, or null.
failure_reasonstringOnly 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 failed and sends no payment.completed webhook. Apple Pay and Google Pay count as authenticated (the buyer's device confirms them).
card fieldTypeDescription
brand, last4stringCard brand (visa, mastercard…) and last four digits. The full card number is never stored or sent.
countrystring | nullISO-2 country of the card's issuing bank.
fundingstringcredit, debit, prepaid or unknown.
walletstring | nullapple_pay, google_pay, another wallet type, or null.
three_d_secureobject | nullresult (authenticated, attempt_acknowledged, not_supported, failed…) and version. null when no 3D Secure ran.
liability_shiftbooleantrue when 3D Secure was authenticated or attempt_acknowledged, or the payment came from Apple Pay / Google Pay.
risk_level, risk_scorestring, number | nullStripe Radar's assessment of the charge (risk_score only with Radar for Fraud Teams).
cvc_checkstring | nullpass, 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:

Stripe Radar rules
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 #

GET/api/v1/orders

Returns your orders, newest first, in the same shape as Retrieve an order. A test key lists only test orders.

Query parameterTypeDescription
statusstringOnly orders with this status: pending, paid, manual_review, rejected, expired or cancelled.
created_from, created_tostringISO 8601 date or date-time. Both ends are inclusive.
limitinteger1–100. Default 20.
beforestringTo get the next page, pass the next_before value from the previous page.
Request
curl "https://payernex.com/api/v1/orders?status=paid&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response · 200 OK
{
  "success": true,
  "data": {
    "orders": [ { "order_ref": "ORD-9F2C61D04B7A3E58", "status": "paid", "amount": 25, … } ],
    "has_more": true,
    "next_before": "ORD-1B07E4A2C9D35F60"
  }
}

Cancel an order #

POST/api/v1/cancel-order/{order_ref}

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"
Response · 200 OK
{
  "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 #

POST/api/v1/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.

FieldTypeDescription
order_refrequiredstringThe order to refund.
amountoptionalnumberAmount 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.
reasonoptionalstring ≤ 255Shown in your dashboard and in the webhook.
idempotency_keyoptionalstring ≤ 64Send 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"}'
Response · 201 Created
{
  "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

GET/api/v1/refunds?order_ref={order_ref}

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 #

StatusMeaningWebhook?
pendingCreated and waiting for payment. Every order starts here.No
paidPayment 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_reviewA 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.
rejectedThe merchant rejected a manual_review payment. Final.No
cancelledCancelled through cancel-order. Only pending orders can be cancelled.No
expiredStill pending after expires_at. A background job expires these, and so does the checkout page the next time it checks the status.No
failedA 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 currency values: USDT (default), BTC, ETH, BNB, BUSD, PKR, USD. Case doesn't matter.
  • Local amount: for bank transfers, also send local_amount and local_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, 25 might become 25.417. The buyer must send exactly the amount in the response.
  • Binance Pay: the buyer enters the note_code as the payment note. A payment within 1% of the amount is accepted automatically. Anything else goes to manual_review.
  • What was received: check paid_amount and paid_currency, not amount. 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_ref against your invoice before you redirect the buyer, and reuse it while it is still pending and 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.
  • GET and cancel-order are safe to retry. Cancelling twice returns 422 the second time.

Hosted checkout #

  • The buyer opens checkout_url and sees every active gateway on your account, plus gateways other merchants have shared with you. Gateways are filtered by their currency rules against local_currency (or currency), and card gateways are hidden when the amount is below their minimum charge.
  • The page shows a countdown to expires_at and updates on its own when the payment is confirmed.
  • When the order is paid, the buyer is redirected to success_url. When it is expired, the page shows a "Return to site" link to cancel_url and redirects there after 5 seconds.
  • A redirect to success_url doesn't prove payment, because anyone can open that URL. Fulfil orders only from the verified webhook or GET /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

POST/api/v1/express_wallet

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.

FieldTypeDescription
merchant_client_idrequiredstring ≤ 100Your stable customer ID (user ID or username). Deposits are credited to this ID.
merchant_client_emailoptionalstringShown in your dashboard.
merchant_client_nameoptionalstringShown in your dashboard.
ipn_urloptionalURLWhere 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_urloptionalURLThe hosted page returns here a few seconds after a deposit (when not in an iframe).
fail_urloptionalURLStored 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"}'
Response · 200 OK
{
  "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.

Body
{
  "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"
  }
}
  1. Verify the signature over the raw body before parsing it.
  2. Credit credited_amount (USD) to merchant_client_id. fee is the customer fee you set; amount is what arrived on-chain.
  3. Use deposit_id as the idempotency key: the same deposit can be delivered more than once. Never credit it twice.
  4. Optionally confirm it first with GET /api/v1/express-wallet/deposits/{deposit_id}.

Read deposits

GET/api/v1/express-wallet/deposits/{deposit_id}
GET/api/v1/express-wallet/deposits?since_id={id}&limit=50&client_id={merchant_client_id}
GET/api/v1/express-wallet/customers/{merchant_client_id}

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).