Skip to main content
The token_encode API is used to encode input data captured manually by a cashier from a customers mobile device. The response will contain a token which can be passed to the Transit API.

token_encode

Params

token
string
required
The token data to encode
provider
string
required
Used to specify the token provider.Available options: giftaway, platform, sharetreats, pluxee, gifted

Response

success
boolean
required
Whether or not a token was scanned
message
string
A failure message if the scan attempt failed
token
string
required
The encoded token data if successful
import * as sdk from "k42-sdk"

const encodeResult = await sdk.tokenEncode("some-token-data", "platform");
if (!encodeResult.success) {
  console.log(`Failed to encode token: ${encodeResult.message}`);
}

console.log(`Token encoded: ${encodeResult.token}`);