Jump to content



Photo
- - - - -

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


  • Please log in to reply
13 replies to this topic

#1   FishHaddock1

FishHaddock1
  • Members
  • 7 posts
  • Real Name:FishHaddock 1

Posted 17 March 2006 - 21:33

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.oscommerc...unity/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,

#2   enigma1

enigma1
  • Members
  • 8,206 posts
  • Real Name:Mark Samios

Posted 19 March 2006 - 17:47

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.

#3   FishHaddock1

FishHaddock1
  • Members
  • 7 posts
  • Real Name:FishHaddock 1

Posted 27 March 2006 - 04:35

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.oscomm...redit card 4388

#4   enigma1

enigma1
  • Members
  • 8,206 posts
  • Real Name:Mark Samios

Posted 27 March 2006 - 15:46

post your catalog\includes\classes\cc_validation.php file.

#5   RoninS14

RoninS14
  • Members
  • 71 posts
  • Real Name:Randy
  • Location:Honolulu

Posted 28 March 2006 - 21:24

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);
}
}
?>



#6   enigma1

enigma1
  • Members
  • 8,206 posts
  • Real Name:Mark Samios

Posted 29 March 2006 - 00:08

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.

#7   RoninS14

RoninS14
  • Members
  • 71 posts
  • Real Name:Randy
  • Location:Honolulu

Posted 29 March 2006 - 00:32

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.

#8   enigma1

enigma1
  • Members
  • 8,206 posts
  • Real Name:Mark Samios

Posted 29 March 2006 - 01:15

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.

#9   RoninS14

RoninS14
  • Members
  • 71 posts
  • Real Name:Randy
  • Location:Honolulu

Posted 29 March 2006 - 02:45

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 /smile.gif' class='bbc_emoticon' alt=':)' />

Edited by RoninS14, 29 March 2006 - 02:46.


#10   xao

xao
  • Members
  • 54 posts
  • Real Name:Tony

Posted 26 April 2006 - 16:51

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!

#11   my scrap shop G

my scrap shop G
  • Members
  • 131 posts
  • Real Name:gillian
  • Location:Brisbane, Australia

Posted 09 June 2006 - 00:56

thank you, that seemed to fix my problem also!

#12   Toypilot

Toypilot
  • Members
  • 1 posts
  • Real Name:Noah Grotheer

Posted 16 November 2006 - 02:29

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.

#13   andy1024

andy1024
  • Members
  • 21 posts
  • Real Name:Andy Lee

Posted 17 February 2008 - 08:48

easy way to fix it is to comment out

return -1;

#14   krdito

krdito
  • Members
  • 92 posts
  • Real Name:Krdito
  • Gender:Female

Posted 11 October 2011 - 16:11

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!!