Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ousret/payment-card-identifier

A Python library for determining credit card type.
https://github.com/ousret/payment-card-identifier

amex card card-identifier card-types credit-card mastercard visa

Last synced: about 2 months ago
JSON representation

A Python library for determining credit card type.

Awesome Lists containing this project

README

        

payment-card-identifier [![Build Status](https://travis-ci.org/Ousret/payment-card-identifier.svg?branch=master)](https://travis-ci.org/Ousret/payment-card-identifier) [![codecov](https://codecov.io/gh/Ousret/payment-card-identifier/branch/master/graph/badge.svg)](https://codecov.io/gh/Ousret/payment-card-identifier)
-----------------------

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

```sh
$ pip install payment-card-identifier
```

##### From git-master

```sh
$ git clone https://github.com/Ousret/payment-card-identifier.git
$ cd payment-card-identifier
$ python setup.py install
```

#### How to

```python
from payment_card_identifier import CardIdentifier

my_card = CardIdentifier.from_numbers('4532040524589053')

print(my_card)
#
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)