📍 Bolt Help / Developer Resources / Developer Tools / Install the Bolt Tokenizer
Install the Bolt Tokenizer
Learn about the Bolt Tokenizer and it's objects.

Bolt’s tokenizer can be used for direct payment processing, when also paired with the authorization endpoint.

Bolt offers its tokenizer as both an API and a public package on NPM. These instructions will walk you through using the NPM package. To use the API, please see the API documentation.

Tokenizer NPM Package

Tokenization is handled in a separate service from Bolt Checkout and is PCI compliant. See the Authorization endpoint’s request body schema for more information.

Requirements

All of the following must be provided when using Bolt’s Tokenizer:

  • A valid credit card number from a supported card network.
  • A valid CVV

How to use the Tokenizer

  1. Install Bolt’s npm package and import the package:
import TkClient from "@boltpay/tokenizer";
  1. Create a new instance of the TkClient object:
const tkClient = new TkClient(env, async (url, request) => fetchFunc(url, request));

TIP

In the initial call, the env value can be to either sandbox or production. fetchFunc is a function used to send HTTP requests (for example, you could use the javascript built-in function fetch).

  1. Call the postToken method with the credit card information:
const cardToken = tkClient.postToken(credit_card); // this function can be retried
  1. Authorize using the v1/merchant/transactions/authorize endpoint found here.

Objects & Values

credit_card is the javascript object {cc: credit card number, cvv: cvv}

postToken returns the javascript object {token, expiry, last4, bin, network}

Object Value
token The token is the newly generated credit card token.
expiry The date at which the token expires. A token must be used within 15 minutes of creation.
last4 The last 4 digits of the card number.
bin The credit card bin.
network The credit card network.

Sample Code

import TkClient from "@boltpay/tokenizer";

const tkClient = new TkClient("sandbox", async (url, request) => fetch(url, request));
const cardToken = tkClient.postToken({cc: "4111111111111111", cvv: "000"});

Example Response

{ 
	"token": "7i8322df93jsor663bsf02be798e672afd9360a81d203rc97778ff4bddedertg", // token created by Bolt tokenizer. Used in a card authorization request. 
	"expiry": "1671140825305", // 15 minutes from time of creation
    "last4": "1111",
    "bin": "411111",
	"network": "visa",
}
Filter by Section
Filter by Topic