card-connect-api

1.0.4 • Public • Published

CardConnect Bolt P2PE API Wrapper

Install

yarn add card-connect-api

Usage

const CardConnectApi = require("card-connect-api");

this.api = new CardConnectApi({
  baseUrl: process.env.BASE_URL,
  merchantId: process.env.MERCHANT_ID,
  authorizationHeader: process.env.AUTHORIZATION
});

List all terminals

await this.api.listTerminals()

Connect to a terminal

await this.api.connectTerminal({
  hsn: process.env.TESTABLE_TERMINAL,
  force: true
});

Ping terminal

await this.api.connectTerminal({
  hsn: process.env.TESTABLE_TERMINAL,
  force: true
});
 await this.api.ping({
  hsn: process.env.TESTABLE_TERMINAL
});

Read Card Present

await this.api.connectTerminal({
  hsn: process.env.TESTABLE_TERMINAL,
  force: true
});
await this.api.readCard({
  hsn: process.env.TESTABLE_TERMINAL,
  amount: 1
});

Read Card Manual

await this.api.connectTerminal({
  hsn: process.env.TESTABLE_TERMINAL,
  force: true
});
await this.api.readManual({
  hsn: process.env.TESTABLE_TERMINAL,
  amount: 1
});

Sample Response

{
 token: '<redacted 16 digit number>',
 expiry: '<redacted 4 digit expiry date>',
 name: '<redacted company name? maybe?>'
}

Set terminal message

await this.api.connectTerminal({
  hsn: process.env.TESTABLE_TERMINAL,
  force: true
});
 await this.api.sendMessage({
  hsn: process.env.TESTABLE_TERMINAL,
  text: "hacked bro"
});

Clear terminal message

await this.api.connectTerminal({
  hsn: process.env.TESTABLE_TERMINAL,
  force: true
});
await this.api.sendMessage({
  hsn: process.env.TESTABLE_TERMINAL,
  text: ""
});

Errors

This wrapper returns errors for

  • User cancelled
  • Terminal is offline
  • Terminal is in use
  • Something went wrong

more information can be found here

Readme

Keywords

none

Package Sidebar

Install

npm i card-connect-api

Weekly Downloads

2

Version

1.0.4

License

none

Unpacked Size

22.6 kB

Total Files

6

Last publish

Collaborators

  • dobiedad