|
Credit Card Account Number Validation LUHN formula
Hello all,
Not sure if this is the correct forum for this but here goes. I am a Web Developer creating a website with a merchant account for a client. While writing the scripts to validate the information the site visitor has submitted before sending it to CyberSource for processing, I came to the part of the form with Card type and Account Number. I did some Google'ing and got to a page that explains that each card has account numbers with specified lengths and prefixes. That helps, but I found more...
One page I found explains the LUHN mod 10 formula. At the time that page was created in 1997, this algorithm applied correctly to Visa, MasterCard, AmEx and Discover which are the cards accepted by my clients site. I do not want to programmatically reject cards that are actually valid, but it would be nice to catch a mis-keyed account number or mis-selected card type before submittal to the payment gateway.
Does anybody know if the LUHN mod 10 formula (aka; The CheckDigit algorithm) is still valid for all Visa, MasterCard, AmEx and Discover card numbers???
Dave
|