Latest News: (loading..)
FishHaddock1

Credit card error: The first four digits of the number entered are

14 posts in this topic

Hello everyone! I have recently started using oscommerce with authorize.net and I'm running into some difficulty with accepting credit card payments.

 

I'm testing the credit cards with my own credit card, beginning with 4388. I put in the right credit card number, and expiry date and I'm getting the following error:

The first four digits of the number entered are: 4388<br>If that number is correct, we do not accept that type of credit card.<br>If it is wrong, please try again

 

Does anyone know why this is happening and how to fix it? It looks like it is not even getting to authorize.net to authorize the credit card -- it is just rejecting it upfront. There is a bug report on this here: but I can't see what the resolution is, except for the fact that the bug has been closed.

 

http://www.oscommerce.com/community/bugs,1609

 

I'm not clear what my oscommerce version is, except that it says copyright 2005 at the bottom, so presumably version 2005:-)

 

Thanks in advance For all your help,

Share this post


Link to post
Share on other sites

its not the 4388 must be the other digits. in your classes\cc_validation.php try changing the first check for visa from

 

if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {

 

to

if (ereg('^4[0-9]{12}([0-9]{1}|[0-9]{3})?$', $this->cc_number)) {

 

there was another post about it where they mentioned the workaround.

Share this post


Link to post
Share on other sites

thank you enigma1 !

 

I tried your work-around, but it didn't resolve the problem. Does anyone else have any suggestions, I see other people have this issue in the forum also, it seems like a pretty large gaping bug.... I'm just not clear how to deal with this and would appreciate your expert advice and thoughts..

 

 

http://forums.oscommerce.com/index.php?sho...redit+card+4388

Share this post


Link to post
Share on other sites

I have the same problem specified above...here's mine

 

<?php

/*

$Id: cc_validation.php,v 1.3 2003/02/12 20:43:41 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class cc_validation {

var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year;

 

function validate($number, $expiry_m, $expiry_y) {

$this->cc_number = ereg_replace('[^0-9]', '', $number);

 

if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {

$this->cc_type = 'Visa';

} elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) {

$this->cc_type = 'Master Card';

} elseif (ereg('^3[47][0-9]{13}$', $this->cc_number)) {

$this->cc_type = 'American Express';

} elseif (ereg('^3(0[0-5]|[68][0-9])[0-9]{11}$', $this->cc_number)) {

$this->cc_type = 'Diners Club';

} elseif (ereg('^6011[0-9]{12}$', $this->cc_number)) {

$this->cc_type = 'Discover';

} elseif (ereg('^(3[0-9]{4}|2131|1800)[0-9]{11}$', $this->cc_number)) {

$this->cc_type = 'JCB';

} elseif (ereg('^5610[0-9]{12}$', $this->cc_number)) {

$this->cc_type = 'Australian BankCard';

} else {

return -1;

}

 

if (is_numeric($expiry_m) && ($expiry_m > 0) && ($expiry_m < 13)) {

$this->cc_expiry_month = $expiry_m;

} else {

return -2;

}

 

$current_year = date('Y');

$expiry_y = substr($current_year, 0, 2) . $expiry_y;

if (is_numeric($expiry_y) && ($expiry_y >= $current_year) && ($expiry_y <= ($current_year + 10))) {

$this->cc_expiry_year = $expiry_y;

} else {

return -3;

}

 

if ($expiry_y == $current_year) {

if ($expiry_m < date('n')) {

return -4;

}

}

 

return $this->is_valid();

}

 

function is_valid() {

$cardNumber = strrev($this->cc_number);

$numSum = 0;

 

for ($i=0; $i<strlen($cardNumber); $i++) {

$currentNum = substr($cardNumber, $i, 1);

 

// Double every second digit

if ($i % 2 == 1) {

$currentNum *= 2;

}

 

// Add digits of 2-digit numbers together

if ($currentNum > 9) {

$firstNum = $currentNum % 10;

$secondNum = ($currentNum - $firstNum) / 10;

$currentNum = $firstNum + $secondNum;

}

 

$numSum += $currentNum;

}

 

// If the total has no remainder it's OK

return ($numSum % 10 == 0);

}

}

?>

Share this post


Link to post
Share on other sites

well you see, I doubt its the 4388 that causes the problem. Because if I add a test number like

4388000000000004

it goes through with the default osc and the default cc module which uses this code you posted. So something else is going on. For instance with the number of digits. The code expects 16 digits. So obviously could be that authorize.net brings an error back.

Share this post


Link to post
Share on other sites

here's the curve ball. I do not use authorize.net...or anything else. I have my own draft capture machine in my retail store provided by my bank and use it for all my online transactions also. So I have my employees input all the online transactions manualy. All I need the website to do is collect the credit card number for me.

Share this post


Link to post
Share on other sites
here's the curve ball. I do not use authorize.net...or anything else. I have my own draft capture machine in my retail store provided by my bank and use it for all my online transactions also. So I have my employees input all the online transactions manualy. All I need the website to do is collect the credit card number for me.

 

ok then just below this line of code you posted:

 

function validate($number, $expiry_m, $expiry_y) {

 

add this

return 1;

 

and try it.

Share this post


Link to post
Share on other sites

it works fine. And that should work for now since I can process each transactions outside of OSC via my draft capture machine. I'll just have to verify the validity of each credit cards before I go ahead and process the orders from now on.

 

thanks a bunch enigma1 :)

Edited by RoninS14

Share this post


Link to post
Share on other sites

I have someone from CA trying to pay with a Visa starting with 4551. It has been verified that this is a valid Visa number for a bank in CA. How do I update my cc_validation file to accept these cards?

 

here is my Visa line in the cc_validation.php....

 

class cc_validation {

var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year;

 

function validate($number, $expiry_m, $expiry_y, $cvv, $cr_card_type) {

$this->cc_number = ereg_replace('[^0-9]', '', $number);

 

if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {

$this->cc_type = 'Visa';

}

 

Thanks!

Share this post


Link to post
Share on other sites

Okay, I'm digging up old topics...

 

I'm having the same problem, and I tried to add the line of code as advised above, but now I get a different error:

 

Warning: str_repeat(): Second argument has to be greater than or equal to 0. in /mnt/w0608/d13/s08/b022a490/www/buyit/catalog/includes/modules/payment/authorizenet.php on line 205

 

Any ideas?

 

I can post the code in authroizenet.php if needed.

 

Thanks in advince!!

Noah G.

Share this post


Link to post
Share on other sites

I am having the same problem with the credit card error message on occasion. I added the "return 1;" to the CC validation file and hope this will fix it. I have already seen that one customer who was receiving the error message was able to check out after I made the change to the validation file.

 

Fingers crossed that this is a permanent fix!!

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