🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

card-connect-api

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

card-connect-api

Node Wrapper for CardConnectApi

1.0.4
latest
npm
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 12 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts