npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@placetopay/pinpad-sdk

v2.0.3

Published

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

Downloads

229

Readme

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

: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"
    }
}