Zero-Downtime IPN Replacement · Eliminate Key-Sort Bugs

Migrer depuis NOWPayments to XPayr in 12 Minutes

Replace fragile JSON key-sorted HMAC-SHA512 IPN callbacks, custodial payout queues, and stuck exchange underpayments with XPayr raw-body HMAC-SHA256 webhooks, 1% ($0.50 max) tolerance, and règlement direct de 99.5% sur portefeuille.

Cutover Time~12 Minutes (Parallel Safe)
NOWPayments Fee0.5%–1.0% + conversion/payout network fees
XPayr Frais de PasserelleFlat 0.5% ($0/mo · $0 Sweep)
XPayr Modèle de garde100 % Non dépositaire (99.5% Direct)

Why Engineering & Finance Teams Switch Away From NOWPayments

JSON re-serialization key-sorting in x-nowpayments-sig breaks whenever nested float or null fields are added.
Intermediary deposit addresses require extra sweep gas or manual dashboard payout thresholds.
Partially paid exchange withdrawals often stall in partially_paid without automatic fulfillment rules.

Field-by-Field API & Webhook Mapping (NOWPayments → XPayr v1)

Keep your existing database order schema intact — map these 6 fields to cut over cleanly.

Integration Layer NOWPayments (Legacy) XPayr Non-Custodial v1
Create Payment Endpoint POST https://api.nowpayments.io/v1/invoice (x-api-key) POST https://xpayr.com/api/v1/payments (Bearer sk_live_...)
Montant de la facture & Fiat price_amount + price_currency ("usd") amount ("99.00") + currency ("USD")
Preferred Crypto Asset pay_currency ("usdttrc20" / "usdcmatic") network ("tron" / "polygon") + token ("USDT" / "USDC")
Order & Webhook Callback order_id + ipn_callback_url order_id + webhook_url + metadata (JSON object)
Webhook Signature Header x-nowpayments-sig (HMAC-SHA512 sorted object) X-XPayr-Signature (HMAC-SHA256 over exact raw HTTP body)
Terminal Paid Status payment_status === "finished" / "partially_paid" event === "payment.completed" / "payment.underpaid_accepted"

Drop-In Migration Adapter (Node.js / Express)

Copy-paste replacement ready for Testnet (sk_test_...) and Mainnet (sk_live_...).
import crypto from 'node:crypto';

/**
 * Drop-in webhook verifier replacing NOWPayments x-nowpayments-sig sorted-JSON logic.
 * Verifies exact raw HTTP body bytes with timing-safe HMAC-SHA256.
 */
export function handleXpayrWebhook(req, res) {
  const rawBody = req.body; // Buffer from express.raw({ type: 'application/json' })
  const sigHeader = String(req.headers['x-xpayr-signature'] || '').replace(/^sha256=/i, '');
  const expected = crypto
    .createHmac('sha256', process.env.XPAYR_WEBHOOK_SECRET)
    .update(rawBody)
    .digest('hex');

  if (expected.length !== sigHeader.length ||
      !crypto.timingSafeEqual(Buffer.from(expected, 'utf8'), Buffer.from(sigHeader, 'utf8'))) {
    return res.status(401).json({ error: 'Invalid XPayr signature' });
  }

  const payload = JSON.parse(rawBody.toString('utf8'));
  if (payload.event === 'payment.completed' || payload.event === 'payment.underpaid_accepted') {
    // Fulfill order using payload.data.order_id and payload.data.tx_hash
  }
  return res.status(200).json({ received: true });
}

4-Step Zero-Downtime Canary Cutover Checklist

1

Connect non-custodial wallets & generate sk_test_ API keys

Register at /merchant/register, paste your destination EVM, Solana, TRON, or multisig wallet addresses, and generate a free API Testnet key.

2

Deploy the X-XPayr-Signature HMAC-SHA256 webhook adapter

Add the raw-body HMAC-SHA256 verification handler alongside your existing NOWPayments callback endpoint and test events in /tools/webhook-tester.

3

Canary 10%–25% of live checkout sessions in parallel

Route a slice of live crypto orders to POST /api/v1/payments (or enable the XPayr storefront plugin) to verify instant règlement direct de 99.5% sur portefeuille.

4

Cut over 100% of traffic & export clean ERP ledgers

Switch primary crypto checkout routing to XPayr, withdraw any remaining custodial float from NOWPayments, and export QuickBooks/Xero CSVs via /accounting.

Questions fréquentes — Switching From NOWPayments

Can we keep NOWPayments active while testing XPayr on production?

Yes. Add XPayr alongside NOWPayments as a parallel payment option or route 20% of crypto sessions to XPayr first; there are $0 monthly fees and zero exclusivity contracts.

How does XPayr handle NOWPayments partially_paid exchange orders?

XPayr Paiement double includes configurable 1 % (max. $0.50 USD) underpayment tolerance, automatically completing minor CEX fee-deducted transfers via payment.underpaid_accepted.

Do our WooCommerce or WHMCS stores need custom code to switch?

No. Install the official open-source XPayr WooCommerce or WHMCS gateway plugin from /plugins, test with sk_test_ keys, and toggle it active in 2 minutes.

Explore All 10 guides de migration fournisseurs