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?


1 Answer 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">
        <type id="DC" order="110">
            <label>Diners Club</label>
        <type id="EL" order="120">

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"
    <module name="Vendor_Module" setup_version="1.0.0">
            <module name="Magento_Payment"/>

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.