SDK for Javascript

Overview

The purpose of the Cardknox JS SDK is to allow the developer to easily implement payments into their web based system. One of the benefits that this has over BBPOS is that it does not require an application to be installed on each computer that uses a device and it can run on multiple different platforms. This SDK currently only supports PAX devices.

Sample Page

https://cdn.cardknox.com/sdk-js/1.0.2009.1101-alpha/sample.html

Find us on GitHub

https://github.com/Cardknox/cardknox-sdk-js

Getting Started

Load our SDK.

https://cdn.cardknox.com/sdk-js/1.0.2009.1101-alpha/cardknox-sdk.min.js <script src="https://cdn.cardknox.com/sdk-js/1.0.2009.1101-alpha/cardknox-sdk.min.js"></script>

SDK Functions

process

Process a transaction.

Arguments

Returns

Type

TransactionRequest

TransactionResponse

var Key = "xxxxxxxxxxxxxx";
var SoftwareName = "CardknoxJSSDK";
var SoftwareVersion = "1.0";
var Command = "cc:sale";
var Amount = "1";
var IpAddress = "1.1.1.1";
var IpPort = "10009";
process({
xKey: Key,
xSoftwareName: SoftwareName,
xSoftwareVersion: SoftwareVersion,
xCommand: Command,
xAmount: Amount,
settings: {
deviceIpAddress: IpAddress,
deviceIpPort: IpPort
}
}).then(function (response) {
console.log(response)
}).catch(function (error) {
console.error(error)
});

getSignature

Prompts for signature on the device. This returns a base64 encoded PNG without the data header.

Args

Returns

Type

Settings

String

var ipAddress = "1.1.1.1";
var ipPort = "10009";
getSignature({
deviceIpAddress: ipAddress,
deviceIpPort: ipPort
}).then(function (response) {
console.log(response)
}).catch(function (error) {
console.error(error)
});

Transaction Request Parameters

TransactionRequest

Name

Type

Description

Valid values

xCommand

String

Transaction type

Enum xCommand

xKey

String

Your Cardknox sale-only key

xSoftwareName

String

Your software name

xSoftwareVersion

String

Your software version

xAmount

Number

Transaction amount

settings

Settings

Transaction settings, these should be the same for all transactions

Setting Parameters

Settings

Name

Type

Description

Valid values

deviceIpAddress

String

IP address of your device

deviceIpPort

String

IP port of your device. Default is “10009”

xCommand parameters

xCommand

List of supported transaction types. These enums are available from the SDK. See more details about each command at https://kb.cardknox.com/api/

Name

Command

CC_SALE

cc:sale

CC_CREDIT

cc:credit

CC_AUTHONLY

cc:authonly

CC_CAPTURE

cc:capture

CC_POSTAUTH

cc:postauth

CC_VOID

cc:void

CC_VOIDRELEASE

cc:voidrelease

CC_VOIDREFUND

cc:voidrefund

CC_BALANCE

cc:balance

EBTFS_SALE

ebtfs:sale

EBTFS_CREDIT

ebtfs:credit

EBTFS_BALANCE

ebtfs:balance

EBTCB_SALE

ebtcb:sale

EBTCB_BALANCE

ebtcb:balance

GIFT_REDEEM

gift:redeem

GIFT_ISSUE

gift:issue

GIFT_BALANCE

gift:balance