Site icon iGoPayGO

See How Credit Card Validation Works

Ever wonder how to validate a credit card or how sites are able to detect if that card entered in is valid without actually connecting to a server. However complex it may seem on the surface, underneath it is quite simple as you can see it fully explained by this page here that breaks down the steps in validating a credit card number. They have stepped though a single example however you can enter in your own test card number to see how it validates. I tried a few just random numbers to see if they would validate. After a few tries I was not only able to get cards to validate, but also I can now switch between different card types, such as VISA, Mastercard and AMEX. Many things that I did not realize have been brought to light such as the first digit on a credit card actually determines the industry the card services.

Example of a number I tried for testing was: 4024-0071-8284-5075

Which returned

Validation Info

Message: Card failed to be valid.
Card Length: 16
Card Type: Visa (16 digit)
Formatted: 4024-0071-8284-5075
Checksum: MOD Validation shows that this is not a validate card.
Check Digit: 2
Fixed: 4024-0071-8284-5072

Once I entered in the fixed number from above the number validated, and I was able to use it in testing my online application. This service of generating credit card numbers is invaluable as having many different numbers on hand for application testing, just makes the code that much more robust.