Accept crypto payments with the Node.js SDK
The official CryptoPayr Node.js SDK is a promise-based, zero-dependency client with bundled TypeScript types. Accept Bitcoin, Ethereum, USDT and 30+ coins from Express, NestJS, Next.js API routes or any Node backend.
How to accept crypto payments with the Node.js SDK
Follow these steps to start taking Bitcoin, Ethereum, USDT and 30+ other coins.
-
Install the SDK
Run
npm install cryptopayr. TypeScript definitions are bundled — no@typespackage needed. -
Initialise the client
Import and construct with your secret key from Dashboard → Developers:
const cp = new CryptoPayr("sk_live_…"); -
Create a payment
Use
await cp.payments.create({ amount, currency: "USD", metadata: orderId })and readcheckout_urlfrom the response. -
Redirect to the hosted checkout
Send the customer to the
checkout_urlto choose a coin and pay. Addresses, fees and confirmations are handled for you. -
Verify the webhook
In your webhook handler, call
CryptoPayr.webhooks.verify(rawBody, signature, apiKey)and complete the order whenstatus === "COMPLETED".
Need the full reference? See the API & webhook documentation, or read about the crypto payment gateway.
Requirements & compatibility
- Node.js 12 or newer
- Zero runtime dependencies
- TypeScript types included
- A free CryptoPayr account & API key
Frequently asked questions
Does it include TypeScript types?
Yes — type definitions ship inside the package, so you get autocomplete and type-checking out of the box.
Is the API promise-based?
Every method returns a promise, so you can use async/await throughout.
How do I read the raw body for webhook verification?
Capture the raw request body (e.g. express.raw()) before JSON parsing, since the signature is computed over the exact bytes CryptoPayr sent.
Where are the full examples?
The API documentation covers payments, payouts, refunds, balances and live rates with Node samples.