I am creating a custom payment module for magento 2 and I am experiencing the following problem. I get an error on the method=renderer.js on the getCode function saying 'Cannot read property '[name of module]' of undefined'. After a little research I see that on cc-form.js I see the following

getCcAvailableTypes: function () {
            return window.checkoutConfig.payment.ccform.availableTypes[this.getCode()];

The window.checkoutConfig.payment.ccform returns only the icon object.

This is my code on method_renderer.js

function (Component) {
    'use strict';
    return Component.extend({
        defaults: {
            template: 'Vendor_Module/payment/module'
        getCode: function() {
            return 'vendor_module';
        isActive: function() {
            return true;
        validate: function() {
            var $form = $('#' + this.getCode() + '-form');
            return $form.validation() && $form.validation('isValid');


Thanks in advance.

1 Answer 1


Try to add below code in your etc/frontend/di.xml

<type name="Magento\Payment\Model\CcGenericConfigProvider">
        <argument name="methodCodes" xsi:type="array">
            <item name="your item name" xsi:type="const">payment code name</item>

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.