Jump to content
Sign in to follow this  
ronr1999

Credit Card Number Validation ?

Recommended Posts

A customer transposed the last two digits of his credit card (visa) and cc_validation.php caught it. At least I think it was cc_validation.php... it might also be: authorizenet.php. I was getting error message: " The credit card number entered is invalid. Please check the number and try again."

 

...it must be authorizenet.php... or ?

 

RonR

Share this post


Link to post
Share on other sites

http://www.beachnet.com/~hstiles/cardtype.html

 

as for which module caught it, it was cc_validation.php, which is a class instantiated in your CC module (cc.php or authorize.net where it is called).

 

I have personally modded cc_validation further to prevent usage of non-visa/mc and check for a proper CVV (which my check will also check for proper CVV on AMEX if I ever decide to accept it).

 

the mod10 check however is the most basic. if a CC doesn't pass mod10, there is no way the number will be correct.

Edited by borghe

Share this post


Link to post
Share on other sites
http://www.beachnet.com/~hstiles/cardtype.html

 

I have personally modded cc_validation further to prevent usage of non-visa/mc and check for a proper CVV (which my check will also check for proper CVV on AMEX if I ever decide to accept it).

 

 

I too only accept Visa and MC. I would like to know how you did the mod. I need to do the same.

Share this post


Link to post
Share on other sites

I believe I posted it elsewhere, but to mod cc_validation just look at the main check at the beginning of the validate function. let it go through and determine what kind of card it is and if it's valid. then at the bottom of the "if"s ad an if for something like

 

if ($card->cc_type != 'Master Card' && $card->cc_type != 'Visa')

return -6;

 

then in your credit card module under the validation section add a case for -6 and have it throw an error message and break;

 

I also added a CVV validation right above it in cc_validation. mine basically says

 

if ((strlen($card->cc_cvv) != 4 && $card->cc_type == 'American Express') || strlen($card->cc_cvv) != 3)

return -5;

 

and then case -5: in the auth.net module is "please enter a valid card security code"

Edited by borghe

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×