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.
and I was wondering if there is a database with valid credit card numbers
I wish, I'd have so much new stuff!
My question is, how is the entered credit card going to be validated?
You will need to use a payment gateway to validate the credit card number.
I also know there is an algorithm to check if the credit card is valid.
You can implement such an algorithm, but just because it passes the check doesn't mean you can charge money to the card.
And after checking the validation how is the charge gonna be made to that credit card and where do you get the money from?
Again, you'll need a payment gateway, such as PayPal or authorize.net
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With