Cool trick I learned from my programmer..
So, you’ve all probably- at some time or another, received an error message when you submitted a credit card for purchase. A pop-up generates stating the card number you entered is not valid, please try again. Perhaps you miss-typed a digit, or maybe left one out.
Have you ever wondered how the heck the computer could know this so fast? Obviously, it didn’t process the number- it happened nearly instantaneously. So how does it know?!?
According to my programmer, there is a mathematical code that the computer calculates once you hit the submit button. If the formula doesn’t check out, you get the error message and it doesn’t even bother to send it to through the payment gateway.
Here’s the formula:
Starting on the left, isolate every other number in the string. Multiply those digits by 2. Then add those results up along with the numbers you left alone. If your final number is divisible by 10, then the computer will deem your credit card as valid.
Here is a cc number, for example, that will pass:
Visa: 4111 1111 1111 1111
Or this:
4444 3333 2222 1111
Why am I sharing this? No, it’s not so you can try to go and hawk things online (obviously, these numbers wouldn’t pass at the authorization point).
But from an implementation standpoint, often times you will need to run many tests to make certain that everything is functioning properly. So instead of using your personal credit card or your programmer having to use his, you can actually have him use one of these dummy card numbers which will be considered valid by your computer all day long. Makes life a lot easier for everyone.
Pretty neat, huh?



