The code you provided has a partial BIN / range for Discover, omits Diner club (which is now owned by Discover), lists the types of cards that no longer exist, and they need to be added to other types (enRoute, Carte Blanche), and ignore the increasingly important basket type Maestro International.
As @Alex confirmed, you can determine the type of card from the BIN number, and many companies do it, but doing it consistently and correctly is not trivial: card brands are constantly changing, and tracking things becomes more difficult, because you try to process regional debit cards (Laser in Ireland, Maestro in Europe, etc.). I did not find the free and supported (correct) part of the code or algorithm for this anywhere.
As @MitMaro is built, Wikipedia contains a list of high-level card identifiers , as well as a more specific list of BIN numbers and ranges , which is a good start, and as gbjbaanb commented, Barclays has a publicly published list (but apparently it doesn't include Discover for any reason - apparently they are not processed on the Discover network?)
Anyway, the correct algorithm / method / function of identifying the card does the maintenance work, so if your detection program is not critical / informational (for example, the @Simon_Weaver sentence), OR you are going to enter the work to keep it up to date, I I would recommend that you skip automatic detection.
Tao Jul 09 '12 at 12:15 2012-07-09 12:15
source share