Pages

Showing posts with label credit card. Show all posts
Showing posts with label credit card. Show all posts

Friday, January 20, 2012

Credit card validation extension for jQuery Validation plugin

Credit card validation extension for jQuery Validation plugin

Here's an improved credit card validation extension for the jQuery Validation plugin. This lets you pass the credit card type into the validation routine, which allows it to do card type specific checks for prefix of the card number and number of digits. This extension includes the mod-10 check (based on the Luhn Algorithm) that is used in the core creditcard validation routine. As an extra bonus, it will ignore spaces and dashes in the card number. This code was ported from this credit card validation routine by John Gardner, with some minor tweaks and additions.

Usage

Here is an overview of one way to use the creditcard2 extension. There are a number of ways you can wire up validation rules with the jQuery Validation plugin, so it helps if you already understand how that plugin generally works (settings, rules, styling, error messages, etc).

Thursday, January 12, 2012

Test Credit Card Account Numbers

Test Credit Card Account Numbers

While testing, use only the credit card numbers listed here. Other numbers produce an error.
Expiration Date must be a valid date in the future (use the mmyy format).