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

iin-checker

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iin-checker

Issuer identification number checker which returns details about a credit/debit card

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

IIN Checker for payment cards

Circle CI Dependency status Dev Dependency Status

NPM

About

Issuer identification number checker which returns details about a credit/debit and other payment cards

Installation

The module is available in the NPM registery. It can be installed using the npm commandline utlity.

npm install iin-checker

Once you have installed the module you can simply require inside of your Node.js application and use it's exported methods. Here is a simple example of that which gets the card details back as an object:

var IinChecker = require( 'iin-checker' );
// Initialise with default options no caching
var iin = new IinChecker( {} );

// Initialise with caching
var iin = new IinChecker( {
    cache: {
      set: function( iin, cardDetails ) {...},
      get: function( iin ) {..}
    }
} );



iin.lookup( '543210', function( err, result ) {
  if ( err ) {
    console.log( 'Error:', err );
  } else {
    console.log( 'Result:', result );
  }
} );

Caching

Caching is turned off by default. It can be turned on by passing in options a cache object with your functions to set and get the cache'.

Card Type Detection

If you want to test to see if the card is a Credit or Debit card you can can achive this in the following way:

var IinChecker = require( 'iin-checker' );
var iin = new IinChecker( {} );

iin.lookup( '543210', function( err, result ) {
  if ( err ) {
    console.log( 'Error:', err );
  } else {
    var isDebit = ( result.type === iin.types.DEBIT )
    console.log( 'Debit?:', isDebit );
  }
} );

Possible values for iin.types are DEBIT, CREDIT and UNKNOWN.

Card Brand Detection

If you want to test to see which brand the card is, you can can achive this in the following way:

var IinChecker = require( 'iin-checker' );
var iin = new IinChecker( {} );

iin.lookup( '543210', function( err, result ) {
  if ( err ) {
    console.log( 'Error:', err );
  } else {
    var isMastercard = ( result.brand === iin.brands.MASTERCARD )
    console.log( 'Mastercard?:', isMastercard );
  }
} );

Possible values for iin.brands are VISA, MASTERCARD, AMEX, DISCOVER, JCB, MAESTRO and LASER. In future more card brands will be supported, if you need a brand adding please raise an issue.

Changelog

Contributing

License

Copyright (c) 2016 Holiday Extras Ltd Licensed under the MIT license.

Todo

  • Get non-provider RegEx alternative
  • Read providers from configs (as the tests do)
  • Allow preference of providers to be passed into options
  • Support caching

FAQs

Package last updated on 25 Nov 2016

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