Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Restrict credit cards by type


Recommended Posts

Hey all,


I need to set my oscommerce cart to only accept visa and mastercard; the documentation refers me to an Admin > Configuration > Credit Card page where I should be able to di this via checkboxes, but I don't see the Credit Cards option under the Configuraiton heading. Am I missing a download?

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

In catalog/includes/classes/cc_validation.php, just comment out the cc types you do not want to accept - this should produce an error message to the customer if they try to use one of those unaccepted cards


Starting about line 19:

	  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;


P.S. The referenced capability in configuration does not exist in the current release of osC - perhaps this is something that is planned for a future release?

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...