08-18-2005, 09:47 AM
Does anyone know of any credit card validation scripts that include validation for switch/maestro?
I found a great script but its very americanised so no good for my purposes :(
08-18-2005, 02:07 PM
I may not be helping since I don't know that switch/maestro is but this is the only one I've used in the past...
08-18-2005, 02:43 PM
that handles visa, mastercard, switch, solo, and amex I think
08-21-2005, 05:38 AM
I do not know of any good prewritten/free scripts available on the web. Maybe some digging on google can produce some results. However, if you want to write your own... read below.
Are you just checking to see if the value is numeric and if the number's prefix is assigned to a specific card type? (that appears to be what the regex is doing). However, something more robust may be used if you implement validation using the Luhn formula (mod 10). Not sure about switch/solo but visa/mastercard/amex and most other credit card numbers can be checked in this fashion.
Luhn Formula -- http://www.webopedia.com/TERM/L/Luhn_formula.html
Also, it may be good to mention that before you pass the number to the above mentioned check it will be wise to check the length and make sure it is correct for the card type trying to be submitted.