Magento has just released a MasterCard validation patch for Magento versions below https://magento.com/tech-resources/download#download2005

NOTE: If you are running CloudFlare, make sure to disable it and Purge Cache after Patch installation. I was punching in credit cards numbers starting with 2xxx and checkout would not validate them. Purging CloudFlare cache fixed the issue!

- Also, make sure to install discovery SUPEE-2725 first, only then install SUPEE 8967

If you found any issues, please post them in this thread.

  • If you want to create a question collecting issues for this patch, you should addresses actual problems and do so in the form of a question – 7ochem May 5 '17 at 13:22
  • Guys you should not close this question, its a reference for those installing the patch. Seriously! As with every Patch there is one major topic, we can relate to. – Icon May 5 '17 at 20:35
  • 1
    Please read my comment. This kind of questions is indeed very helpful, but you should formulate it as a question and ask about issues. You should post your solution for the specific "CloudFlare" issue and "SUPEE-2725" issue as an answer. If you have edited your question is such a way, then you will have my reopen vote! ;) – 7ochem May 8 '17 at 10:15

Two things to keep in mind after applying this patch:

  • If you're using a payment method that deals with credit cards but that is not the default Magento CC payment method (that patch only applies on Mage_Payment_Model_Method_CC), you'll have to double check that this payment method is supporting the 2XXX Mastercard CC numbers.
  • I've seen a numerous amount of Magento installations where the js/prototype/validation.js (where the patch is applied) is rewritten. Ensure this file is not overriden and if it is, bring the patch changes over the file you're using if you don't want the credit card frontend validation to fail when using 2XXX CC numbers.

Apart from that, the changes in the patch are the exact same changes as the one that are here from

| improve this answer | |
  • I have installed the patch on 1.7 version and I can see that after installation I have two files validation.js and validation.js.orig. and also same thing for cc.php and cc.php.orig. Is this normal to create .orig files after patch installation? Overall, the store not started to accept both MasterCards 2xxx and 5xxx. – Icon May 3 '17 at 18:57
  • patching file app/code/core/Mage/Payment/Model/Method/Cc.php Hunk #1 succeeded at 122 with fuzz 1 (offset -1 lines). patching file js/prototype/validation.js Hunk #1 succeeded at 851 with fuzz 2 (offset -30 lines). – Icon May 3 '17 at 19:00
  • I think the reason it created. orig files is because duing SUPEE 8967 Installation there were two hunk errors, but it still installed. – Icon May 3 '17 at 19:01
  • Excellent advise regarding validation.js being overriden! – mpchadwick May 4 '17 at 16:13

The two files affected with this patch are here


and below is the changes for this patch

diff --git app/code/core/Mage/Payment/Model/Method/Cc.php app/code/core/Mage/Payment/Model/Method/Cc.php
index 3d9db00..39f7e21 100644
--- app/code/core/Mage/Payment/Model/Method/Cc.php
+++ app/code/core/Mage/Payment/Model/Method/Cc.php
@@ -123,7 +123,7 @@ class Mage_Payment_Model_Method_Cc extends Mage_Payment_Model_Method_Abstract
                     // Visa
                     'VI'  => '/^4[0-9]{12}([0-9]{3})?$/',
                     // Master Card
-                    'MC'  => '/^5[1-5][0-9]{14}$/',
+                    'MC'  => '/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/',
                     // American Express
                     'AE'  => '/^3[47][0-9]{13}$/',
                     // Discovery
diff --git js/prototype/validation.js js/prototype/validation.js
index c9c1798..ef9308c 100644
--- js/prototype/validation.js
+++ js/prototype/validation.js
@@ -881,7 +881,7 @@ Validation.creditCartTypes = $H({
     'SO': [new RegExp('^(6334[5-9]([0-9]{11}|[0-9]{13,14}))|(6767([0-9]{12}|[0-9]{14,15}))$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
     'SM': [new RegExp('(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
     'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true],
-    'MC': [new RegExp('^5[1-5][0-9]{14}$'), new RegExp('^[0-9]{3}$'), true],
+    'MC': [new RegExp('^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$'), new RegExp('^[0-9]{3}$'), true],
     'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true],
     'DI': [new RegExp('^6011[0-9]{12}$'), new RegExp('^[0-9]{3}$'), true],
     'JCB': [new RegExp('^(3[0-9]{15}|(2131|1800)[0-9]{11})$'), new RegExp('^[0-9]{3,4}$'), true],

please note if you have done some modification in above two files then this patch will fail

so in that case copy original file from default installation and revert that file and apply this patch.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.