Need to extend credit-card-type.js for add master card detection new/latest pattern:

I am creating and extending payment method using this link http://inchoo.net/magento-2/implementing-payment-gateway-magento-2/

Its working fine ... just not detecting master card type until I put all 16 digit of the credit card this is the problem i am facing

As of my understanding and research magento making credit-card-type.js at below path:


need to override this for add/update new pattern for master card detection like below link: https://stackoverflow.com/a/72801/3820040

Checking if anyone have the resolution of the issue... Please let me know if you can help.

1 Answer 1


By doing some research and development I found below solution/way to override js file:

Just go to requirejs-config.js file at below path... If you dont find then create the file. [Namespace]/[Module]/view/frontend/requirejs-config.js and

add below code:

var config = {
    map: {
        '*': {

Before this above code first take/copy credit-card-type.js file from below path:


and pase at your module js file location at


Then you can make your custom changes as like I have done in my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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