@buckaroo/buckaroo_sdk

中文文档
1.14.0发布于 2026/11/05ISCTypeScriptESM + CJS构建来源已验证近 30 天下载 9123

Buckaroo payment SDK

原始使用文档
文档目录14 节
  1. About
  2. Requirements
  3. Installation
  4. Getting started
  5. Configuring the client
  6. Creating a payment
  7. Retrieving transaction information
  8. Validating push messages
  9. Server-side use only
  10. Testing
  11. Support
  12. Contribute
  13. Versioning
  14. License

Buckaroo — Node SDK

Buckaroo Node SDK

Latest release Node version Documentation Download from npm

About · Requirements · Installation · Getting started · Server-side use only · Testing · Support · Contribute


About

Buckaroo is a Dutch Payment Service Provider. More than 54,000 organisations rely on the Buckaroo platform to process their payments, subscriptions and unpaid invoices.

This is Buckaroo's official Node SDK: a modern, open source library that connects a JavaScript or TypeScript application to the Buckaroo API. It ships CommonJS and ES module builds along with TypeScript declarations, so it works in either module system without extra configuration.

Full SDK documentation on docs.buckaroo.io, and the API reference for request parameters and service codes.


Requirements

RequirementSupported versions
Node.js6.14 or higher

You also need a Buckaroo account. Don't have one yet? Request an account.


Installation

npm install @buckaroo/buckaroo_sdk

Or with yarn:

yarn add @buckaroo/buckaroo_sdk

Getting started

Configuring the client

You can find your Store key and Secret key under API credentials in Buckaroo Plaza. Set mode to TEST while developing and to LIVE in production.

import Buckaroo from '@buckaroo/buckaroo_sdk';

const buckarooClient = Buckaroo.InitializeClient(
    {
        websiteKey: 'YOUR_STORE_KEY',
        secretKey: 'YOUR_SECRET_KEY',
    },
    {
        mode: 'TEST', // or 'LIVE'
        currency: 'EUR',
        returnURL: 'https://example.com/return',
        pushURL: 'https://example.com/push',
    }
);

[!NOTE] The websiteKey option takes your Store key. The Store key was previously called the Website key, and the option name has been kept for backwards compatibility.

[!TIP] Keep your Secret key out of version control. Load both keys from environment variables instead — the repository ships an .env.example to start from.

Creating a payment

Every payment method takes a slightly different payload. This example charges a Mastercard:

const payment = await buckarooClient
    .method('mastercard')
    .pay({
        amountDebit: 100,
    })
    .request();

Swap mastercard for any other service code to use a different payment method. Service codes and their parameters are listed in the API reference.

Retrieving transaction information

Once a transaction exists you can query it on demand:

const transaction = buckarooClient.transaction(payment.getTransactionKey());

await transaction.status();     // transaction status
await transaction.refundInfo(); // refund info
await transaction.cancelInfo(); // cancellation info

Validating push messages

Pass the raw request body to ReplyHandler as a string. Read the push values from data(), not from your own parse of the body. data() only returns the fields after they pass validation.

import { ReplyHandler } from '@buckaroo/buckaroo_sdk';

// HTTP post push: the raw application/x-www-form-urlencoded body
const reply = new ReplyHandler(buckarooClient.credentials, rawBody).validate();

// JSON push: also pass the Authorization header and the full push URL
// const reply = new ReplyHandler(buckarooClient.credentials, rawBody, req.headers.authorization, pushUrl).validate();

if (reply.isValid()) {
    const push = reply.data();
    // push.brq_statuscode, push.brq_invoicenumber, ...
}

More runnable examples are in example/.


Server-side use only

[!WARNING] Use this library from your server only. Never bundle it into a website or mobile app.

This library is written in JavaScript, so it is technically possible to include it in front-end code — but doing so exposes your Secret key to everyone who loads the page. Anyone holding that key can act on your account's behalf.

In the intended setup, your server holds the Secret key and calls the Buckaroo API through this SDK. Nothing sensitive reaches the browser.


Testing

npm install
npm test

Tests run with Jest. Formatting is handled by Prettier:

npm run prettier

Tests that talk to the Buckaroo test environment need credentials, so copy .env.example to .env and fill in your test Store key and Secret key first.


Support

Having trouble? Work through this list before reaching out:

  1. Check the SDK documentation and the API reference.
  2. Confirm you are on the latest release.
  3. Reproduce the issue with mode: 'TEST' and inspect the full response, including the status subcode and message.
  4. Verify that your push URL is reachable from outside your network. Buckaroo sends push messages from fixed IP addresses and ports, so make sure these are on your allow list. See push messages for the current list.

Still stuck? Contact us and include your Node.js version, SDK version, the service and action you called, the error message and the transaction key.


Contribute

We really appreciate it when developers help improve the Buckaroo SDKs. Please read our Contribution Guidelines before opening a pull request, and target the master branch.

Found a security issue? Please report it privately to [email protected] instead of opening a public issue.


Versioning

We follow semantic versioning (MAJOR.MINOR.PATCH):

  • MAJOR — breaking changes that require additional testing and caution.
  • MINOR — new functionality with limited impact.
  • PATCH — bug fixes and hotfixes only.

All changes are documented in the changelog and on the releases page.


License

This SDK is open source software licensed under the MIT license.


Made with care by Buckaroo.
This document is subject to change; typos and language errors are possible.

版本与发布记录

@buckaroo/buckaroo_sdk 共发布 34 个版本,首次发布于 2023/04/20;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.14.0latest2026/11/053 天前
1.13.02026/10/1425 天前
1.12.32026/09/251 个月前
1.12.22026/08/192 个月前
1.12.12026/07/213 个月前
1.12.02026/05/145 个月前

关于 @buckaroo/buckaroo_sdk 的常见问题

@buckaroo/buckaroo_sdk 是什么?

Buckaroo payment SDK

如何安装 @buckaroo/buckaroo_sdk?

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

@buckaroo/buckaroo_sdk 支持 TypeScript 吗?

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

@buckaroo/buckaroo_sdk 支持 ESM 还是 CommonJS?

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

@buckaroo/buckaroo_sdk 需要什么版本的 Node.js?

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

@buckaroo/buckaroo_sdk 可以商用吗?

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

@buckaroo/buckaroo_sdk 的下载量有多少?

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

@buckaroo/buckaroo_sdk 还在维护吗?

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