views:

142

answers:

3
+1  A: 

Hum, imho you need a payment provider to use credit card payment anyway - they'll give you a kind of api to check the data against.

dhh
+2  A: 

To validate a credit card is legitimate:

  1. Verify it against the Luhn Algorithm. (Will only validate the card number is in a valid format)
  2. Verify the card number against known Issuer Identification Numbers
  3. Perform an Authorization Only (aka AUTH ONLY) for $0.00 (or $0.01 if your processor does not support zero auths). This is the only guaranteed way to verify a credit card exists.
John Conde
A: 

To at least validate the code is valid you can give this a try: http://www.notesbit.com/index.php/web-mysql/web-scripts/luhn-algorithm-in-c/

Chris T