How to get card type information using unimag credit card reader

1.7k Views Asked by At

I want to integrate card swipe feature in my application using unimag card reader device provided by ID Tech. It provides name, account number and expiry date in a single string. But no information about the card type. Is there a way to retrieve the information about the "The type of Card" user hols. Like visa, master, etc.

2

There are 2 best solutions below

0
On

The cliff notes version:

If card starts with:
3 - Amex (15 digits)
4 - Visa (13-19 digits, usually 16)
5 - Mastercard (16 digits)
6 - Discover (16 digits)

There are some other more rare card types like JCB and Diners which you might need to account for if your solution has to deal with those.

0
On

Card type is determine from first couple of digits

example code here http://cuinl.tripod.com/Tips/o-1.htm

a quick google for implementations :-)