Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.pawpayments.com/llms.txt

Use this file to discover all available pages before exploring further.

The @pawpayments/sdk package is the official Node.js SDK for the Native V2 API. It covers the same REST resources as the Python SDK, uses only built-in fetch at runtime (no HTTP dependencies), ships ES modules and CommonJS builds plus .d.ts, and exposes webhook verification helpers aligned with other official integrations.
PropertyValue
Package name@pawpayments/sdk
GitHubpawpayments/node-sdk
Minimum Node.js18
Runtime dependenciesNone (fetch required)

Installation

npm install @pawpayments/sdk
pnpm add @pawpayments/sdk
yarn add @pawpayments/sdk

Quick start

import { PawPayments } from "@pawpayments/sdk";

const paw = new PawPayments({ apiKey: process.env.PAW_API_KEY! });

const invoice = await paw.invoices.create({
  amount: 25,
  fiat_currency: "USD",
  billing_type: "STATIC",
  asset: "usdt_tron",
  description: "Pro plan, 1 month",
  notify_url: "https://example.com/paw/webhook",
});

console.log(invoice.payment_url);
PawPaymentsOptions also accepts baseUrl (default https://api.pawpayments.com), timeoutMs, and a custom fetch implementation for constrained runtimes.

Resources

Successful calls return unwrapped result payloads (or list envelopes where the API paginates). Failures throw PawPaymentsApiError with code, httpStatus, message, and optional details.
AttributeMethods
paw.assetslist()
paw.ratesget({ base, assets })
paw.balanceget()
paw.invoicescreate(), get(id), list(), notify(id)
paw.payoutscreate(params, { uniqId }), get(id), list(), batch(items, { uniqId })
paw.ledgerlist({ ... })
paw.notificationslist(), test(url?)
paw.permanentcreate(), get(id), list(), deactivate(id)
payouts.create and payouts.batch accept optional uniqId for idempotency (UUIDv4). If omitted, the SDK uses crypto.randomUUID(); duplicates within two hours yield HTTP 409.

Webhook verification

Validate against the raw body buffer or Uint8Array your framework exposes — parsing JSON first and re-stringifying will change bytes and fail HMAC checks.
import { Webhook } from "@pawpayments/sdk";

const sigHeader = req.header("X-Paw-Signature") ?? "";
if (!Webhook.verifyRawBody(req.body, sigHeader, process.env.PAW_API_KEY!)) {
  return res.status(401).end();
}

const payload = Webhook.parsePayload(req.body);
Permanent-address callbacks that include permanent_address_id should return 200 OK without duplicating checkout-specific side effects, consistent with the PHP plugins.

Errors

import { PawPaymentsApiError } from "@pawpayments/sdk";

try {
  await paw.invoices.create({});
} catch (err) {
  if (err instanceof PawPaymentsApiError) {
    console.error(err.code, err.httpStatus, err.message, err.details);
  }
}