A McGraw Hill Book Plug-in PHP: 100 Power Solutions
By Robin Nixon (McGraw Hill 2010, ISBN 978-0071666596)

Home | About | Buy It | Download | Contact

Select Chapter: 1  2  3  4  5  6  7  8  9 10 11 12

Chapter 6: Plug-in 32 - Validate Credit Card

Sometimes people make mistakes when entering credit card numbers in web forms, or even just make numbers up to see what will happen. Using this plug-in you can at least ensure that a credit card number and expiration date you have been provided with has an acceptable number sequence, a correct checksum and a valid expiry date. This enables you to only pass on sensible-looking details to your card processing organization, and possibly limit any additional fees that may be charged.

The Figure shows a made up credit card number that doesn't pass validation.