Anyone have any experience with displaying a credit card image dynamically based on the card number entered?
Is there some sort of usable list to run an if then against to set an image to visible or hidden?
Any help/advice is appreciated Thank you
Anyone have any experience with displaying a credit card image dynamically based on the card number entered?
Is there some sort of usable list to run an if then against to set an image to visible or hidden?
Any help/advice is appreciated Thank you
The first six digits of a card number (including the initial MII digit) are known as the issuer identification number (IIN). These identify the card issuing institution that issued the card to the card holder. The rest of the number is allocated by the card issuer.
This is followed by table of IIN's which sheds much darkness on the matter: It's really up to six digits, usually one, three, or four. For example, if it starts with 4, it's a VISA (or a co-branded Dankort card), unless the first four digits are 4903, 4905, 4911, or 4936, in which case it's a Switch debit card. But Switch cards no longer exist; they were sold to MasterCard in 2002, rebranded as Maestro, and new cards were issued. Nevertheless somebody's kid may dig one out of the attic and try to use it.
There's nothing logically difficult or clever about it; it's just a series of comparisons to prefixes of varying lengths. The sensible implementation would be a series of substring or regex comparisons, if/else/else/else etc.
A trie would be much more fun to write but it's not really cricket to leave that kind of code for potentially incompetent (or just busy) successors to maintain.