Integrate crypto payments into your Node.js application using the official XPayLabs Node.js SDK (@xpaylabs/node-sdk). The SDK provides typed API bindings for TypeScript and JavaScript with automatic HMAC signing, webhook verification, and full TypeScript type declarations.
Installation
The SDK requires Node.js 14+.
Configuration
| Option | Required | Default | Description |
|---|
apiKey | Yes | — | Merchant token |
apiSecret | Yes | — | API secret for HMAC signing |
baseUrl | No | https://api.xpaylabs.com | Gateway base URL (override for self-hosted deployments) |
timeout | No | 30000 | Request timeout in ms |
Core API Methods
Create a Collection Order
Create a Payout
Query Order Status
Get Supported Symbols
Handling Webhooks
Use an Express.js endpoint to receive and verify webhook callbacks:
The webhook has built-in replay protection — events with timestamps older than 30 seconds are rejected.
Error Handling
TypeScript Support
The SDK ships with complete type declarations. Import the types directly:
The SDK handles HMAC-SHA256 signing internally — you don’t need to compute signatures manually. All POST requests are automatically wrapped in the ReqPayload envelope with sign, timestamp, and nonce.