Docs · Plugins

Plugins & integrations

No code required

The official plugins call the REST API for you. They create the order, send the buyer to the PayerNex checkout, check the signed webhook, look the order up again, and mark it paid in your store.

Overview #

Every plugin needs the same two values from Dashboard → Developer: your API key (the plugins call it the "Merchant Token") and your Webhook Secret.

WooCommerce #

Requires WooCommerce 7.0+ and PHP 7.4+.

  1. Install Download payernex-woocommerce.zip from the repository's Releases page. In WP admin, go to Plugins → Add New → Upload Plugin, choose the zip, then Install Now and Activate.
  2. Configure Go to WooCommerce → Settings → Payments → PayerNex → Manage. Enable the gateway and paste the Merchant Token (API Key) and the Webhook Secret.
  3. Currency handling If your store is in USD, choose My store is in USD (1 USD = 1 USDT). For any other currency, choose Convert via fixed rate and enter the rate, for example 278 for PKR. The plugin divides the order total by this rate to get the USDT amount. If Forward the native store-currency amount is on, it also sends the store total as local_amount/local_currency, so bank-transfer buyers see the amount in their own currency.
  4. Test Place a small order and choose PayerNex. Once paid, WooCommerce moves the order to Processing (physical goods) or Completed (virtual goods).

What the plugin sends

create-order fieldValue
amountOrder total in USDT, rounded to 2 decimals
customer_idWC-<order id>
descriptionOrder #<order id> at <site name>
ipn_urlhttps://your-store.com/?wc-api=payernex_webhook
success_url / cancel_urlThe WooCommerce "order received" page / the cancel-order URL

The plugin sends its webhook URL with every order as ipn_url, so PayerNex always notifies the right store. When the webhook arrives, the plugin checks X-Signature, calls GET /api/v1/order/{order_ref}, and completes the order only if the API says the status is paid. It takes the paid amount from the API and never trusts the amount in the webhook body. Turn on Debug Log to see entries under WooCommerce → Status → Logs (source payernex). If your host uses aggressive page caching, exclude /?wc-api=payernex_webhook from it.

WHMCS #

Requires WHMCS 8.0+ and PHP 7.2+ with the curl extension.

  1. Upload Unzip and upload the modules folder into your WHMCS root. It adds modules/gateways/payernex.php, modules/gateways/payernex/ and modules/gateways/callback/payernex.php.
  2. Activate Go to System Settings → Payment Gateways → All Payment Gateways and click PayerNex.
  3. Configure Paste your API Key and Webhook Secret. If your invoices are not in USD, USDT or PKR, set Convert To For Processing to USD.
  4. Test Open an unpaid invoice and press Pay Now. To test without real money, use a test_ key and switch on Accept test payments. Switch it off again before going live.

Pay Now creates a 30-minute PayerNex order for the invoice balance and sends the client to the checkout. Pressing it again in that time reuses the same order. When the payment arrives, the callback checks X-Signature, only accepts orders the module created, and looks the order up again with GET /api/v1/order/{order_ref}. It credits the invoice, in the invoice's own currency, only when that order is paid in the expected currency for at least the requested amount. The blockchain, Binance or bank reference becomes the WHMCS transaction id. Every step is written to Billing → Gateway Log, and repeat notifications are ignored.

Dhru Fusion (self-hosted) #

Requires Dhru Fusion v2024 or newer and PHP 7.4+ with the curl extension.

  1. Upload the files Copy modules/gateways/payernex.php and modules/gateways/callback/payernex.php into the matching folders of your Dhru installation. The easiest way is to upload the whole modules/ folder into your Dhru root.
  2. Allow the callback through .htaccess Dhru's modules/gateways/callback/.htaccess blocks every PHP file that isn't on its list. Open it, find the <FilesMatch "…"> line, and add |^payernex\.php to the end of the list. Don't replace the whole file. If you skip this step, every PayerNex callback returns 403 Forbidden.
  3. Activate In the Dhru admin, go to Settings → Payment Gateways → PayerNex → Activate. Paste your API key into Merchant Token and your Webhook Secret into Webhook Secret, then save.
  4. Test Add funds for a test customer (for example $1), pay with PayerNex, and check that Dhru marks the invoice Paid.
modules/gateways/callback/.htaccess
<FilesMatch "^wombi\.php|^gourlio\.php|…|^galaxpay\.php|^payernex\.php">

The module sends Dhru's callback (<your Dhru URL>/modules/gateways/callback/payernex.php) as the ipn_url on each invoice. It sends the amount as USDT, customer_id = DHRU-<invoice id>, and Dhru's base-currency amount as local_amount/local_currency. The callback checks X-Signature, confirms the order with GET /api/v1/order/{order_ref}, and then marks the invoice paid.

ProblemWhat to check
Buyer sees "Invalid credentials"The Merchant Token doesn't match your current API key. Copy it again, especially if you regenerated the key.
Paid on PayerNex but the invoice is still unpaidCheck Recent Deliveries in Dashboard → Webhooks. A 403 means the .htaccess step is missing. A 401 or "Invalid signature" means the Webhook Secret doesn't match.
"PayerNex" isn't listed under Payment GatewaysCheck that both files are in the right folders, then reload the admin page.

Dhru Fusion Pro (Custom Gateway) #

Dhru Fusion Pro is hosted, so it can't load a PHP module. Instead, PayerNex works as a Dhru Custom Gateway. There's nothing to download.

Dhru Custom Gateway fieldValue
Post URLhttps://payernex.com/api/v1/dhru-pro/checkout
API KeyYour PayerNex API key (Dashboard → Developer)

How it works: Dhru posts each invoice to the Post URL. PayerNex creates a 30-minute order (reference DHRU-PRO-<invoice id>-<random>) in the invoice currency and returns the checkout URL, and Dhru sends the buyer there. Once the order is paid, PayerNex notifies the ipn_url that Dhru supplied, using Dhru's own charge.confirmed format. Dhru then calls PayerNex back to confirm the invoice is Paid before crediting it. As with the API, your account needs an active subscription and order quota.

PayerNex Android app (bank SMS forwarding) #

Bank transfers have no API to confirm them. When a bank gateway is set up for SMS matching, PayerNex confirms a transfer from the credit-alert SMS your bank sends. The PayerNex app runs on an Android phone that gets those SMS and forwards them to PayerNex, which matches each one to the pending order with that amount. It needs Android 7.0 or newer.

  1. Install the APK The app isn't on Google Play because Play doesn't allow SMS-forwarding apps, so allow installs from your browser or file manager when Android asks.
  2. Grant permissions Open the app and allow SMS and Camera.
  3. Scan your gateway's QR In the PayerNex dashboard, open Gateway settings and edit your bank gateway. In the app, tap the QR icon in the top bar and scan the QR code shown there. The forwarding rule is added automatically.
  4. Done SMS from your bank's sender number (the one set on the gateway) now go to PayerNex. Keep the phone powered and online.

No Android phone? The bank gateway settings also explain how to forward alerts with an iPhone Shortcuts automation, or with email forwarding for banks that send credit alerts by email. If an alert doesn't match any order, you can receive it as a transaction.unclaimed webhook.

SDKs #

Each SDK is one file with no dependencies. Copy it into your project. All three offer the same calls: create, get and cancel an order, create and list refunds, and verify a webhook signature (both X-Signature and X-PayerNex-Signature).

Node.js
// Node.js
const { PayerNex } = require('./payernex');
const pnx = new PayerNex(process.env.PAYERNEX_API_KEY);

const order = await pnx.createOrder({ amount: 25, currency: 'USD', ipn_url: 'https://shop.example/ipn' });
res.redirect(order.checkout_url);

// IPN handler: verify with the raw body, then trust the API, not the body
app.post('/ipn', express.raw({ type: 'application/json' }), async (req, res) => {
  const event = PayerNex.parseWebhook(req.body, req.get('X-Signature'), process.env.PAYERNEX_WEBHOOK_SECRET);
  const fresh = await pnx.getOrder(event.order_ref);
  if (fresh.status === 'paid') { /* fulfil the order once */ }
  res.sendStatus(200);
});
Python
# Python
from payernex import PayerNex
pnx = PayerNex(os.environ["PAYERNEX_API_KEY"])
order = pnx.create_order(amount=25, currency="USD", ipn_url="https://shop.example/ipn")

event = PayerNex.parse_webhook(request.get_data(), request.headers.get("X-Signature"), os.environ["PAYERNEX_WEBHOOK_SECRET"])
if pnx.get_order(event["order_ref"])["status"] == "paid":
    ...

Errors raise PayerNexError (PHP: PayerNex\PayerNexException) with the HTTP status and the API's message, or status 0 when the network fails. A test_ key works the same way and creates test orders.

MCP server for AI assistants #

The PayerNex MCP server connects your account to AI assistants that support the Model Context Protocol, such as Claude Desktop, Claude Code and Cursor. You can then ask questions like "How much did I sell this week?", "Which orders are waiting for review?" or "Make a 25 USD payment link for Ali". It is one file and needs Node.js 18 or newer. It runs on your own computer and talks only to the PayerNex API, using your key.

Add it to your assistant's MCP configuration. For Claude Desktop, that is Settings → Developer → Edit Config:

claude_desktop_config.json
{
  "mcpServers": {
    "payernex": {
      "command": "node",
      "args": ["/full/path/to/payernex-mcp.js"],
      "env": { "PAYERNEX_API_KEY": "YOUR_API_KEY" }
    }
  }
}

With Claude Code: claude mcp add payernex -e PAYERNEX_API_KEY=YOUR_API_KEY -- node /full/path/to/payernex-mcp.js

ToolWhat it does
list_orders, get_orderFind orders by status and date, and see what was paid
sales_summaryPaid orders and totals per currency over the last N days, plus orders waiting for review
create_checkoutCreate a 30-minute payment link to send to a customer
cancel_orderCancel a pending order
list_refunds, create_refundSee refunds, and refund card (Stripe) payments

Start with a test key. A test_ key only sees and creates test orders. Most assistants ask before they run a tool. With a live key, keep that approval on for cancel_order and create_refund.

Reseller module for Dhru #

/downloads/payernex.php is not a payment gateway. It's a Dhru Fusion API module that lets authorised PayerNex resellers sell PayerNex plans from their own Dhru panel. Resellers get the setup steps and their reseller API key in the reseller hub. Merchants accepting payments should use the Dhru Fusion gateway module above.

Coming soon #

Shopify, OpenCart, PrestaShop and Magento 2 are on the roadmap. Until then you can integrate any platform with the REST API and webhooks. Need another integration? Request a plugin.