yarn add card-connect-api
const CardConnectApi = require("card-connect-api");
this.api = new CardConnectApi({
baseUrl: process.env.BASE_URL,
merchantId: process.env.MERCHANT_ID,
authorizationHeader: process.env.AUTHORIZATION
});
await this.api.listTerminals()
await this.api.connectTerminal({
hsn: process.env.TESTABLE_TERMINAL,
force: true
});
await this.api.connectTerminal({
hsn: process.env.TESTABLE_TERMINAL,
force: true
});
await this.api.ping({
hsn: process.env.TESTABLE_TERMINAL
});
await this.api.connectTerminal({
hsn: process.env.TESTABLE_TERMINAL,
force: true
});
await this.api.readCard({
hsn: process.env.TESTABLE_TERMINAL,
amount: 1
});
await this.api.connectTerminal({
hsn: process.env.TESTABLE_TERMINAL,
force: true
});
await this.api.readManual({
hsn: process.env.TESTABLE_TERMINAL,
amount: 1
});
{
token: '<redacted 16 digit number>',
expiry: '<redacted 4 digit expiry date>',
name: '<redacted company name? maybe?>'
}
await this.api.connectTerminal({
hsn: process.env.TESTABLE_TERMINAL,
force: true
});
await this.api.sendMessage({
hsn: process.env.TESTABLE_TERMINAL,
text: "hacked bro"
});
await this.api.connectTerminal({
hsn: process.env.TESTABLE_TERMINAL,
force: true
});
await this.api.sendMessage({
hsn: process.env.TESTABLE_TERMINAL,
text: ""
});
This wrapper returns errors for
User cancelled
Terminal is offline
Terminal is in use
Something went wrong
more information can be found here