@blindpay/node

中文文档
6.0.0发布于 2026/10/28MITTypeScriptESM + CJS构建来源已验证近 30 天下载 3089

Official Node.js SDK for Blindpay API - Stablecoin API for global payments

原始使用文档
文档目录12 节
  1. Installation
  2. Authentication
  3. Quick Start
  4. Check for available rails
  5. Response format
  6. Success response
  7. Error response
  8. Error handling
  9. Safe retries (idempotency)
  10. Webhooks
  11. Support
  12. License

BlindPay Node.js SDK

The official Node.js SDK for BlindPay - Stablecoin API for global payments.

Installation

npm install @blindpay/node
# or
yarn add @blindpay/node
# or
pnpm add @blindpay/node
# or
bun add @blindpay/node

Authentication

To get started, you will need both your API key and your instance id, you can obtain your API key and instance id from the BlindPay dashboard https://app.blindpay.com/instances/{instanceId}/api-keys

import { BlindPay } from '@blindpay/node';

const blindpay = new BlindPay({
    apiKey: 'your-api-key-here',
    instanceId: 'your-instance-id-here'
  })

[!NOTE]
All api calls are going to use the provided api key and instance id

Quick Start

Check for available rails

async function getAvailableRails() {
    const blindpay = new BlindPay({
      apiKey: 'your-api-key-here',
      instanceId: 'your-instance-id-here'
    });

    const { data, error } = await blindpay.available.getRails();
    
    if (error) {
        throw new Error(error.message)
    }
    
    console.log('Rails: ', data)
 }

 getAvailableRails()

Response format

All API methods return a consistent response format

Success response

{
  data: /* your data */ ,
  error: null
}

Error response

{
  data: null,
  error: {
    message: "Error message"
  }
}

Error handling

This SDK uses a consistent error handling pattern. Always check for errors:

const { data, error } = await blindpay.payins.list();

if (error) {
  // error.code is a stable code (e.g. PAYOUTS_INSUFFICIENT_BALANCE); error.description is
  // safe to show to end users; include error.trace_id when contacting support.
  console.error('API Error:', error.code ?? error.message);
  return;
}

console.log('Success:', data); // fully typed

Safe retries (idempotency)

Every method that creates, updates or deletes something takes an optional last argument. Pass an idempotencyKey and a retry with the same key and the same input replays the original response instead of acting twice, for example when a timeout leaves you unsure whether a payout was created. Keys are kept for 24 hours.

import { randomUUID } from 'node:crypto';

const idempotencyKey = randomUUID(); // reuse it only to retry this same call

const { data, error } = await blindpay.payouts.createEvm(
  { quote_id: 'qu_000000000000', sender_wallet_address: '0x...' },
  { idempotencyKey }
);

Webhooks

constructWebhookEvent verifies the Svix signature and returns the payload typed by its webhook_event. It throws a BlindPayError when verification fails. Pass the raw request body, not a re-serialized object.

const event = blindpay.constructWebhookEvent({
  secret: process.env.BLINDPAY_WEBHOOK_SECRET as string,
  headers: {
    id: req.headers['svix-id'] as string,
    timestamp: req.headers['svix-timestamp'] as string,
    signature: req.headers['svix-signature'] as string,
  },
  payload: rawBody,
});

switch (event.webhook_event) {
  case 'tos.accept':
    console.log('ToS accepted:', event.tos_id);
    break;
  case 'customer.update':
    console.log('KYC status:', event.kyc_status);
    break;
}

verifyWebhookSignature is still available when you only need a boolean.

For detailed API documentation, visit:

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Made with ❤️ by the BlindPay team

版本与发布记录

@blindpay/node 共发布 44 个版本,首次发布于 2025/09/28;过去 12 个月发布了 32 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.0.0latest2026/10/2811 天前
5.4.02026/10/2811 天前
5.3.12026/08/073 个月前
5.3.02026/08/053 个月前
5.2.02026/08/043 个月前
5.1.02026/08/043 个月前

关于 @blindpay/node 的常见问题

@blindpay/node 是什么?

Official Node.js SDK for Blindpay API - Stablecoin API for global payments

如何安装 @blindpay/node?

在项目目录运行 npm install @blindpay/node,或使用 pnpm add / yarn add / bun add。

@blindpay/node 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@blindpay/node 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@blindpay/node 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.*。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@blindpay/node 可以商用吗?

@blindpay/node 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@blindpay/node 的下载量有多少?

根据 npm 官方下载统计,@blindpay/node 在 2026/10/09 – 2026/11/07 这 30 天内被下载 3,089 次,日均约 103 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@blindpay/node 还在维护吗?

最新版本 6.0.0 发布于 2026/10/28(11 天前);至今共发布 44 个版本,其中过去 12 个月发布了 32 个;首次发布于 2025/09/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。