Javascript SDK

Overview

The Cardknox Javascript SDK allows for integration between Cardknox and web applications. It offers incredible flexibility in that it supports a wide variety of platforms and does not require any application to be installed on the merchant's device.
The JavaScript SDK is currently compatible with the PAX S300, S920, and A series devices.

Sample Page and Latest Version Number

Find Us on GitHub

Getting Started

Load our SDK. https://cdn.cardknox.com/sdk-js/1.0.2111.1801-beta/cardknox-sdk.min.js <script src="https://cdn.cardknox.com/sdk-js/1.0.2111.1801-beta/cardknox-sdk.min.js"></script>

SDK Functions

process
Process a transaction.
​
Arguments
Returns
Type
TransactionRequest
TransactionResponse
1
var Key = "xxxxxxxxxxxxxx";
2
var SoftwareName = "CardknoxJSSDK";
3
var SoftwareVersion = "1.0";
4
var Command = "cc:sale";
5
var Amount = "1";
6
var IpAddress = "1.1.1.1";
7
var IpPort = "10009";
8
process({
9
xKey: Key,
10
xSoftwareName: SoftwareName,
11
xSoftwareVersion: SoftwareVersion,
12
xCommand: Command,
13
xAmount: Amount,
14
settings: {
15
deviceIpAddress: IpAddress,
16
deviceIpPort: IpPort
17
}
18
}).then(function (response) {
19
console.log(response)
20
}).catch(function (error) {
21
console.error(error)
22
});
Copied!
getSignature
Prompts for signature on the device. This returns a base64 encoded PNG without the data header.
​
Args
Returns
Type
Settings
String
1
var ipAddress = "1.1.1.1";
2
var ipPort = "10009";
3
getSignature({
4
deviceIpAddress: ipAddress,
5
deviceIpPort: ipPort
6
}).then(function (response) {
7
console.log(response)
8
}).catch(function (error) {
9
console.error(error)
10
});
Copied!

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