Node SDK

Welcome to the Buckaroo Node SDK Documentation. This SDK is an open-source Node.js library designed to simplify the integration of Buckaroo’s payment services into your JavaScript or TypeScript applications.


Requirements

Before you begin, make sure you have:

  • A Buckaroo account - Click here to get started
  • Node.js 6.14.x or higher


Installation

npm install @buckaroo/buckaroo_sdk

Example

Initiate the Buckaroo Client

Initiate the Buckaroo client with your store key and secret key. These keys can be obtained from your Buckaroo account.

import Buckaroo from '@buckaroo/buckaroo_sdk';

const buckarooClient = Buckaroo.InitializeClient(
    {
        secretKey: 'KEY',
        websiteKey: 'SECRET',
    },
    {
        mode: 'TEST', // OR 'LIVE'
        currency: 'EUR',
        returnURL: 'RETURN_URL',
        pushURL: 'PUSH_URL',
    }
);

Create a Payment

Create a payment with all the available payment methods. In this example, we show how to create a credit card payment. Each payment has a slightly different payload.

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

Retrieve Transaction Information

After you create a transaction, you can retrieve several transaction information on demand.

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

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

Usage Outside of Node.js

This library is written in JavaScript, a versatile programming language with broad applicability. While it's technically possible to integrate this library into a website or mobile application, it's strongly advised against doing so.

In the standard configuration, you make requests to the Buckaroo API using one of our provided libraries, typically from your server (such as a Node.js server). Your secret key is securely stored on this server, inaccessible to external entities.

However, if you incorporate this library directly into a website or app, your secret key will be exposed to users. This could enable users to take action on your behalf using that key.


Contribute

We appreciate it when developers contribute to improving the Buckaroo plugins. If you want to contribute as well, then please follow our Contribution Guidelines.


Versioning

  • MAJOR: Breaking changes that require additional testing/caution.
  • MINOR: Changes that should not have a big impact.
  • PATCHES: Bug and hotfixes only.