Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit Card Number Validation ?


ronr1999

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

Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...