Possible Duplicate:
What is the best way to validate a credit card in PHP?
I am thinking of making an online shopping cart, using credit card validation. My question is, how is the entered credit card going to be validated? I am new to credit card validation, and I was wondering if there is a database with valid credit card numbers? (I know you can do this through PayPal). I also know there is an algorithm to check if the credit card is valid. And after checking the validation how is the charge gonna be made to that credit card and where do you get the money from? Excuse me if my question(s) are naive
You want to look at the Luhn algorithm: http://en.wikipedia.org/wiki/Luhn_algorithm
This is the algorithm that basically looks at a credit card number and decides if it’s a valid number. This doesn’t mean that it’s an actual, real credit card. You would need a credit card processor/gateway for that (see: Authorize.NET, Paypal, etc).
This algorithm has been implemented in PHP many times, and I’m sure with a simple Google search you can find some code in PHP that representes the Luhn algorithm.
Good luck.