Skip to content
ArionPay

Node.js / TypeScript library

Accept crypto payments in your Node.js app

Create a crypto invoice from your Node.js server, send the customer to the ArionPay payment page, and check the signed webhook when they pay. The money goes straight to your own wallet.

Install

npm install arionpay
Source on GitHub
Example

What it does

ArionPay for Node.js developers

arionpay is the official ArionPay client for Node.js. It creates and reads invoices, and checks the signature of every webhook on the raw body before you trust it.
Read moreIt has no dependencies, ships ESM and CommonJS builds with TypeScript types, and runs on Node.js 18 or newer. ArionPay never holds the money: each payment goes straight to your own wallet.
  • No dependencies. Node.js 18 or newer.
  • ESM and CommonJS, with TypeScript types.
  • Every invoice request carries an idempotency key, so a network error can never create two invoices. Up to 3 attempts by default (maxAttempts).
  • Signs each invoice request with HMAC-SHA256 and your API secret. The secret itself is never sent.
  • verifyWebhook checks the ArionPay-Signature header on the raw body and throws ArionPaySignatureError when it does not match or is more than 5 minutes old.
  • simulatePayment moves a test invoice through scenarios such as exact, underpaid_1pct, overpaid or late, and sendTestWebhook sends a signed sample event.
  • Errors are ArionPayError with an HTTP status and a code such as rate_limited or unknown_asset. Messages never contain your secret.

Requirements and licence

Works with
Node.js 18 or newer · Express, Next.js (App Router) · ESM, CommonJS and TypeScript types
Cost
The library is free. ArionPay charges 0.5% per payment, with no monthly fee.
Source
Open source (MIT) on GitHub.

Setup

Set it up in 5 steps

  1. Step 1

    Install the package

    Run npm install arionpay. It has no dependencies.

  2. Step 2

    Copy your keys

    In your ArionPay dashboard, open your store and copy the API key (pk_) and the API secret (sk_, it asks for your authenticator code). The webhook signing secret (whsec_) is on the Webhooks page. Keep all three on your server, never in browser code.

  3. Step 3

    Create an invoice

    Call createInvoice with the amount, currency and your orderId, then redirect the customer to invoice.invoiceUrl.

  4. Step 4

    Check the webhook

    Set your webhook address on the Webhooks page, or per invoice with callbackUrl. Read the body with express.raw, pass it to verifyWebhook, and deliver the order on invoice.paid.

  5. Step 5

    Test without real money

    Create an invoice with test: true and an asset such as USDT_TRC20, then call simulatePayment(invoice.id, "exact"). Your webhook gets invoice.paid, like a real payment.

After the setup

How a payment reaches your code

  • invoice.pending: a payment was seen on the network and waits for confirmations. Show "payment on its way", but do not deliver yet.
  • invoice.paid: fully paid and confirmed, or accepted by you by hand in the dashboard. Deliver the order only on this event (or when getInvoice says paid). A customer coming back to successUrl proves nothing.
  • Before you deliver, match the invoice to your order: your orderId or metadata, and the same amount and currency as the order's current total.
  • invoice.partial, invoice.expired and invoice.needs_review never mean deliver. A late payment can still turn an expired invoice into paid.
  • ArionPay sends a webhook again for about 3 days until your server answers 2xx, so the same event can arrive twice. Use event.id to handle each one once.

16 coins and tokens on 9 networks

All coins
  • BTCBitcoin
  • ETHEthereum
  • USDTEthereum
  • USDCEthereum
  • BNBBNB Smart Chain
  • USDTBNB Smart Chain
  • USDCBNB Smart Chain
  • POLPolygon
  • USDTPolygon
  • USDCPolygon
  • TRXTRON
  • USDTTRON
  • LTCLitecoin
  • DOGEDogecoin
  • BCHBitcoin Cash
  • DASHDash

Questions about the ArionPay Node.js library

Short answers before you add it to your code.

Yes. In an App Router route, read the body with await request.text() and pass it to verifyWebhook with the arionpay-signature header and your webhook secret.

Developer libraries