Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.k42.com/llms.txt

Use this file to discover all available pages before exploring further.

The SDK has the ability to communicate with the bDigital scanner connected to the POS. This can be done by calling the token_scan method which is used to scan a token from a customers mobile device. Calling token_scan will trigger the scanner to begin listening for scans and the red scanning light will be activated for the duration of the request.

token_scan

Params

timeout_ms
number
required
How long to wait before giving up the scan attempt.
retries
number
required
How many attempts to scan a token should be made
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 scanResult = await sdk.tokenScan(30000, 3, "platform");
if (!scanResult.success) {
  console.log(`Failed to scan a token: ${scanResult.message}`);
}

console.log(`Token scanned: ${scanResult.token}`);