1

I need to add some news credit cards type to Magento 2 like:

"DC" => "Diners Club"
"EL" => "ELO"

I know that Magento 2 has the default credit card above:

"AE" => "American Express"
"VI" => "Visa"
"MC" => "MasterCard"
"DI" => "Discover"
"JCB" => "JCB"
"SM" => "Switch/Maestro"
"DN" => "Diners"
"SO" => "Solo"
"MI" => "Maestro International"
"MD" => "Maestro Domestic"
"OT" => "Other"

But how to add Diners Club and Elo?

Thanks!

1

Haven't tested this, but seems like it should be possible to do it like this:

Create a basic custom module and in /etc/payment.xml add new CC types:

<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment:etc/payment.xsd">
    <credit_cards>
        <type id="DC" order="110">
            <label>Diners Club</label>
        </type>
        <type id="EL" order="120">
            <label>ELO</label>
        </type>
    </credit_cards>
</payment>

This should declare new types for the entire Magento app.

I think you also need this in /etc/module.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Payment"/>
        </sequence>
    </module>
</config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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