Ousret / payment-card-identifier

A Python library for determining credit card type.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

payment-card-identifier Build Status codecov

Payment card identifier provides a useful utility method for determining a credit card type from both fully qualified numbers. Same as braintree/credit-card-type but in Python.

Installation

From PyPi
$ pip install payment-card-identifier
From git-master
$ git clone https://github.com/Ousret/payment-card-identifier.git
$ cd payment-card-identifier
$ python setup.py install

How to

from payment_card_identifier import CardIdentifier

my_card = CardIdentifier.from_numbers('4532040524589053')

print(my_card)
# <payment_card_identifier.card.VISA object at 0x10b336b38>
print(my_card.json)
# {
#    "_name": "VISA",
#    "_numbers": "4532040524589053",
#    "_regex": "^4[0-9]{12}(?:[0-9]{3})?$"
# }

Currently supported cards

  • VISA
  • MasterCard
  • Amex
  • BCGLOBAL
  • CarteBlanche
  • DinersClub
  • Discover
  • InstaPayment
  • JCB
  • KoreanLocal
  • Laser
  • Maestro
  • Solo
  • Switch
  • UnionPay

WiP

This is still work in progress project. Currently under dev.

Todo list:

  • Create .from_partials(numbers)

About

A Python library for determining credit card type.

License:MIT License


Languages

Language:Python 100.0%