npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bk-sdk

v1.0.0

Published

The Boku Direct Payments API is a payment gateway API that enables merchants to accept payments through local payment methods such as digital wallets and carrier/mobile billing. It acts as a bridge between merchants and payment issuers (wallets, mobile ca

Downloads

13

Readme

Getting Started with Boku Direct Payments API

Introduction

API Security

Security is a significant consideration for payment platforms. As part of the registration process for each registered merchant account, merchants receive a security key used to authenticate communications in either direction.

Developers should consult the Boku API Signature Authentication Guide for additional details with respect to implementing security on the Boku APIs.

API Usage

When a consumer chooses to use a local payment-method (wallet), the consumer must go through an 'optin' flow to authenticate. This is accomplished using a redirect to the issuer's app or website where the consumer authenticates and completes the opt-in process.

After the consumer adds their local payment-method (wallet), as their registered payment method, the 'charge' method is used to charge the consumer's local payment-method.

If a customer decides to refund a transaction, the 'refund-charge' method can be used to refund the transaction.

API Versioning

The Boku Payment Gateway API is versioned to provide support for changes to functionality without affecting existing integrations. Each API URL includes version information that enables distinct functionality across different versions.

There are several types of changes that could result in a new API version:

  1. New API functionality – new APIs, new parameters, additional information in responses, improved error reporting.
  2. Deprecated API functionality – deprecated APIs, deprecated parameters, deprecated error messages.
  3. Changes in functionality – existing functional behavior changes such as the returned result of a call. A warning is changed to an error. Validation becomes stricter or more lenient.

In these cases, Boku will release a new API version through a new endpoint(s). When new versions of existing APIs are added, support for existing versions is maintained. Unless otherwise stated, as a rule, compatibility is maintained across versions. Prior supported endpoints should have unchanged behavior. If an API is deprecated and scheduled to be removed, a notice of not less than 6 months will be given. Requests for extensions to this period can be considered.

Boku may make changes to the API within an existing version without changing the version number. An example of a non-versioning change would be the addition of an optional field to a request or to a response.

API Calls

URL Scheme

All the below API calls are against URLs that follow the pattern,

https://${api-node}.boku.com/${api-family}/${api-version}/${api-call}

Definitions for the above placeholders:

  • api-node: This follows the pattern '${country}-api4' (e.g. 'us-api4').
    • 'country' is the two letter country code of the end-user's payment-method against which the call is made.
    • The country code is required and is used for more efficient routing of the request.
    • The country code in the url must match the country code supplied in the optin-request.country element.
  • api-family: Groups a family of related API methods.
    • In this API, family is either one of:
      • 'optin' - For interacting with the user or handset to obtain billing approval.
      • 'billing' - For actually performing billing operations against the user.
  • api-version: In this version of the API, this value is always the string '3.0'.
    • Calls under different version numbers may be used in the future to introduce non-compatible API changes.
  • api-call: The name particular API call or method to invoke, for example 'charge' or 'refund-charge'.
    • This usually matches the XML root element name, sans the '-request' suffix.

Fully qualified API call URLs are documented with each of the example calls detailed below.

Install the Package

Run the following command from your project directory to install the package from npm:

npm install [email protected]

For additional package details, see the Npm page for the [email protected] npm.

Test the SDK

To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.

To run the tests, navigate to the root directory of the SDK and execute the following command:

npm run test

Or you can also run tests with coverage report:

npm run test:coverage

Initialize the API Client

Note: Documentation for the client can be found here.

The following parameters are configurable for the API Client:

| Parameter | Type | Description | | --- | --- | --- | | country | string | Country code in ISO 3166-1-alpha-2 standardDefault: 'gb' | | environment | Environment | The API environment. Default: Environment.MerchantTestEnvironment | | timeout | number | Timeout for API calls.Default: 0 | | httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. | | unstableHttpClientOptions | any | Unstable configurable http client options. |

The API client can be initialized as follows:

Code-Based Client Initialization

import { Client, Environment } from 'bk-sdk';

const client = new Client({
  timeout: 0,
  environment: Environment.MerchantTestEnvironment,
  country: 'gb',
});

Configuration-Based Client Initialization

import * as path from 'path';
import * as fs from 'fs';
import { Client } from 'bk-sdk';

// Provide absolute path for the configuration file
const absolutePath = path.resolve('./config.json');

// Read the configuration file content
const fileContent = fs.readFileSync(absolutePath, 'utf-8');

// Initialize client from JSON configuration content
const client = Client.fromJsonConfig(fileContent);

See the Configuration-Based Client Initialization section for details.

Environment-Based Client Initialization

import * as dotenv from 'dotenv';
import * as path from 'path';
import * as fs from 'fs';
import { Client } from 'bk-sdk';

// Optional - Provide absolute path for the .env file
const absolutePath = path.resolve('./.env');

if (fs.existsSync(absolutePath)) {
  // Load environment variables from .env file
  dotenv.config({ path: absolutePath, override: true });
}

// Initialize client using environment variables
const client = Client.fromEnvironment(process.env);

See the Environment-Based Client Initialization section for details.

Environments

The SDK can be configured to use a different environment for making API calls. Available environments are:

Fields

| Name | Description | | --- | --- | | MerchantTestEnvironment | Default | | ProductionEnvironment | - |

List of APIs

SDK Infrastructure

Configuration

HTTP

Utilities