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.
$ pip install payment-card-identifier
$ git clone https://github.com/Ousret/payment-card-identifier.git
$ cd payment-card-identifier
$ python setup.py install
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})?$"
# }
- VISA
- MasterCard
- Amex
- BCGLOBAL
- CarteBlanche
- DinersClub
- Discover
- InstaPayment
- JCB
- KoreanLocal
- Laser
- Maestro
- Solo
- Switch
- UnionPay
This is still work in progress project. Currently under dev.
Todo list:
- Create .from_partials(numbers)