-1

I know it's possible to test if a card is valid with regex, but how would I test if a card is active and can be charged? I just tried to sign up for a free trial of a popular online streaming service with my old de-activated visa card and the number was valid, but still declined when I tried to move forward.

Is there some general way to test for this?

Whenever I google for this I get a lot of paypal tutorials, and I'd like to stay away from paypal if possible.

John Conde
  • 212,985
  • 98
  • 444
  • 485
hermancain
  • 1,248
  • 1
  • 17
  • 24

1 Answers1

1

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
  • 212,985
  • 98
  • 444
  • 485