0.06
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Find out how your customers are paying
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0
 Project Readme

CreditCardBins - A Credit Card IIN/BIN lookup Ruby gem.

Build Status Gem Version Coverage Status

The Issuer Identification Number (IIN), previously known as Bank Identification Number (BIN) is the first six numbers of a credit card. These identify the institution that issued the card to the card holder and provide useful information about the card that can help make your payments flow smarter.

The database is located in lib/data and the gem does not use any third-party API.

Installation

Add this line to your application's Gemfile:

gem 'credit_card_bins'

And then execute:

$ bundle

Or install it yourself as:

$ gem install credit_card_bins

How to use CreditCardBins

CreditCardBins is designed to make it easy to access a credit card's brand, issuer, type and more.

Examples using string monkey patch

require 'credit_card_bins'

'497040'.credit_card_bin_brand #"VISA"
'497040'.credit_card_bin_type #"CREDIT"
'497040'.credit_card_bin_category #"CLASSIC"
'497040'.credit_card_bin_issuer #"LA BANQUE POSTALE"
'497040'.credit_card_bin_country #{"alpha_2"=>"FR", "alpha_3"=>"FRA", "name"=>"France"}

Example using the CreditCardBin Class

require 'credit_card_bins'

number = "378282246310005"
bin = CreditCardBin.new(number)

bin.bin #"378282"
bin.brand #"AMERICAN EXPRESS"
bin.type #"CREDIT"
bin.category #"SMALL CORPORATE"
bin.issuer #"AMERICAN EXPRESS COMPANY"
bin.country #{"alpha_2"=>"US", "alpha_3"=>"USA", "name"=>"United States"}

bin.visa? #false
bin.amex? #true
bin.mastercard? #false

bin.debit? #false
bin.credit? #true
bin.prepaid? #false

When credicard number is not found, will be throws an exception NotFound.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request