I have an extension that has some config fields in the payment section. The extension does not supply a payment method, I just want to have the settings in the Payment Methods section.


<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Example_MyExtension" setup_version="0.1">

The system.xmllooks like this:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <section id="payment">
      <group id="myextension" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="1">
        <field id="activate_export" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
          <label>Export Orders</label>

And thats what it looks like: MyExtension

So everything's fine until now. Now I want to have a default value, so I create config.xml.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">

When I try to open the configuration, I see nothing and get the following error in system.log:

Payment model name is not provided in config!

The error is thrown in /vendor/magento/module-payment/Helper/Data.php in getMethodInstance(). As far as I can tell, the code tries to load a payment method named myextension and fails.

When I place the configuration under section sales, everything works as expected.


  1. Is this a bug?
  2. If not, is it not only allowed to put configuration for payment modules in payment?
  • I'm facing same error...how to solve it @Manuel
    – Mahi M
    Mar 7, 2018 at 8:04
  • @PriyaM did you try to create a payment.xml or setting a title in etc/config.xml (see answers)?
    – Manuel M
    Mar 8, 2018 at 7:15
  • <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <default> <payment> <fee_config> <fee_enabled>1</fee_enabled> <fee_title>codfee</fee_title> </fee_config> </payment> </default> </config>
    – Mahi M
    Mar 8, 2018 at 7:16
  • Yes.....this is my config.xml file.but still not getting config values
    – Mahi M
    Mar 8, 2018 at 7:16
  • Hi @ManuelM Did you get the solution for this? I am struggling
    – Daniel_12
    Mar 27, 2019 at 12:42

7 Answers 7


I also had this problem when I removed my module and reinstall again. Just solved it a few second ago. You need to create a payment.xml since you are creating a payment module.

By the way the payment.xml can be created using CedCommerce payment module creator. I think the link has been shared by the savior above.

    <method name="(here type in your module name in lower case)">


Put this payment.xml in your module etc directory and it should able to be solved. You may use the method name to register a configprovider in model if you wish.

  • 1
    I disagree with this answer. See my own answer for details.
    – peedee
    Nov 16, 2016 at 10:14
  • I'm facing same error...but it not works for me.how to solve it
    – Mahi M
    Mar 7, 2018 at 7:04

I disagree with the accepted answer. I found myself in a similar situation as OP and made my own experiments to get rid of this error, and what solved it for me was setting a title in etc/config.xml.


<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
                <title>My method</title>   <!-- backend will show errors if TITLE isn't set to a value here -->

                <merchant_id backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
                <security_key backend_model="Magento\Config\Model\Config\Backend\Encrypted" />

The accepted answer talk about etc/payment.xml but that made no difference for me (the backend works even when that file does not exist).

  • I had the same issue but I did have a title in config.xml, so I don't think the title is related. However I did not have the payment.xml entry mentioned in the accepted answer.
    – snez
    May 27, 2021 at 11:47

You need to provide <model> node in your config.xml file. See example from Authorize.net module:

php bin/magento setup:di:compile

to create payment module with 3ed party api website follow the below post if it helps accept the answer which help others Payment module redirect to payment website url in magento2


As of Magento 2.3 and 2.4, the only place this message is created is within vendor/magento/module-payment/Helper/Data.php as follows:

    public function getMethodInstance($code)
        $class = $this->scopeConfig->getValue(

        if (!$class) {
            throw new \UnexpectedValueException('Payment model name is not provided in config!');

        return $this->_methodFactory->create($class);

And getMethodModelConfigName is declared just before this one:

    protected function getMethodModelConfigName($code)
        return sprintf('%s/%s/model', self::XML_PATH_PAYMENT_METHODS, $code);

Which means both @Bery's and @Antoine's responses are correct.

However, for those like me, you may have been fooled by opcache. Opcache caches the things when in use and the model may not exist after you've installed your module because Magento is still reading it from the cache generated prior to that.

That said, the solution would be:

  1. Make sure you've cleaned your opcache (or restart php-fpm and nginx/apache)
  2. Make sure your payment module have defined the model as stated by @Bery
  3. Do bin/magento setup:di:compile.

1.I got the Same error while adding a custom payment method in the checkout page. I resolved the error by following:

a.Make sure the payment method code is added same as the title for the payment method.

b.Make sure in the config.xml,the title is added the same as payment method code.

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.