Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@placetopay/pinpad-sdk

Package Overview
Dependencies
Maintainers
4
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@placetopay/pinpad-sdk

This API provides a PinPad Javascrypt SDK to conect with PinPad service of Placetopay.

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

PinPad

A PIN pad or PIN entry device (PED) is an electronic device used in a debit, credit or smart card-based transaction to accept and encrypt the cardholder's personal identification number (PIN).

This API provides a PinPad SDK service with PinBlock generation encrypted according to ISO 9564. This specification describes four formats to generate a PinBlock. You can get more information abouts these formats here at

  • ISO 9564 (Wikipedia).
  • PIN-BLOCKS (EFTLAB).

:pushpin: Installation

Use the following command to install this library.

 npm i @placetopay/pinpad-sdk

:books: Usage

Initialize the PinPad JavaScript SDK

For the PinPad will be successfully loaded, you must initialize the sdk as shown below:

import PinPad from '@placetopay/pinpad-sdk'

let pad = new PinPad({
   format: 0, // may be 0,1,2 or 3
   locale: document.documentElement.lang, // language to display
   mask: true   // may be true, false or any string (i.e '*', '-', ...)
})

Connection with PINPAD backend

If you plan to use the standard backend from JavaScript SDK to get numbers positions and generate pinblocks, let's set the base endpoint URL and your API TOKEN in PinPadClient class.

const client = new PinPadClient(url, token)

You can perform a request to create a transaction and obtain the transaction id and positions as follows:

const response = client.createTransaction()
    .then(res => {
        return res.data
    }).catch(err => {
        return err
    })

You will get a response like the following

{
    "status": {
        "status": 1000,
        "message": "The token has been successfully validated. PinPad SDK will be loaded"
    },
    "data": {
        "positions": "7296183540",
        "transactionId": "c89cb967-dcd3-467e-aebc-0299b1acb707"
    }
}

Render PinPad

You can use the render method of the PinPad class to render the pinpad. You only need pass it the html id and positions (obtained from PINPAD back)

pad.render('div_id', positions)

Send PIN to encrypt

To send the PIN to encrypt, the PinPad JavaScript SDK provides a funtion sendPin(transactionId, data). Return Pinblock.

send PIN as shown below:

const data = {
    transactionId,  // transaction id
    format, // format to apply (required)
    pin,    // positions digits from user (required)
    pan,    // card number (required if format is 0 or 3)
}

client.generatePinBlock(data)
    .then(res => {
        return res.data
    }).catch(err => {
        return err
    })

You'll get a response like the following

{
    "status": {
        "status": 1000,
        "message": "The PinBlock has been successfully generated."
    },
        "data": {
        "pinblock": "A810A95D0562214A"
    }
}

Keywords

FAQs

Package last updated on 23 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc