Magento 2 Payment : Config Provider not workingMagento 2 Payment method : Add custom Select field that I can use in checkout processHow can i rewrite TierPrice Block in Magento2Understanding object manager argument replacement using di.xml for commandsMagento model extension experiment, return: “class does not exist”main.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2: unable to set payment Transaction Id after successful payment processing (solved by myself)Magento 2.1 Create a filter in the product grid by new attributeMagento offline custom Payment method with drop down listMagento 2.3 Can't view module's front end page output?magento 2.2 trying to save multi select value in database

Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?

Who invented Monoid?

Is this n-speak?

Markov-chain sentence generator in Python

Escape Velocity - Won't the orbital path just become larger with higher initial velocity?

How would timezones work on a planet 100 times the size of our Earth

Weird resistor with dots around it

Running code generated in realtime in JavaScript with eval()

Submitting a new paper just after another was accepted by the same journal

Why did Saruman lie?

Corroded Metal vs Magical Armor, should it melt it?

Does EU compensation apply to flights where the departure airport closes check-in counters during protests?

Boss asked a co-worker to assault me

Can the IPA represent all languages' tones?

Why is tert-butoxide often used in elimination reactions when it is not necessary?

Telephone number in spoken words

How is являться different from есть and быть

What are those bumps on top of the Antonov-225?

In which case does the Security misconfiguration vulnerability apply to?

Do Reform Jews believe in a theistic God?

Boss wants me to ignore a software API license prohibiting mass download

Help, I cannot decide when to start the story

My cat is a houdini

Swap on SSD in 2019?



Magento 2 Payment : Config Provider not working


Magento 2 Payment method : Add custom Select field that I can use in checkout processHow can i rewrite TierPrice Block in Magento2Understanding object manager argument replacement using di.xml for commandsMagento model extension experiment, return: “class does not exist”main.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2: unable to set payment Transaction Id after successful payment processing (solved by myself)Magento 2.1 Create a filter in the product grid by new attributeMagento offline custom Payment method with drop down listMagento 2.3 Can't view module's front end page output?magento 2.2 trying to save multi select value in database






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have followed sample-module-payment-gateway to implement Payment method in Magento 2.



But for some strange reason, Custom Config Provider in Magento is not working. It throws Following error :




TypeError: window.checkoutConfig.payment.test_finance is undefined



Here is the di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="Test_finance" xsi:type="object">TestCapitalFinanceModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

<virtualType name="TestFinanceFacade" type="MagentoPaymentModelMethodAdapter">
<arguments>
<argument name="code" xsi:type="const">TestCapitalFinanceModelPaymentTestFinance::METHOD_CODE</argument>
<argument name="formBlockType" xsi:type="string">TestCapitalFinanceBlockForm</argument>
<argument name="infoBlockType" xsi:type="string">TestCapitalFinanceBlockInfo</argument>
<argument name="valueHandlerPool" xsi:type="object">TestCapitalValueHandlerPool</argument>
<!-- argument name="validatorPool" xsi:type="object">TestCapitalValidatorPool</argument -->
<!-- argument name="commandPool" xsi:type="object">TestCapitalCommandPool</argument -->
</arguments>
</virtualType>

<virtualType name="TestFinanceConfig" type="MagentoPaymentGatewayConfigConfig">
<arguments>
<argument name="test_finance" xsi:type="const">TestCapitalFinanceModelCustomConfigProvider::METHOD_CODE</argument>
</arguments>
</virtualType>

<!-- Value handlers infrastructure -->
<virtualType name="TestFinaceGatewayValueHandlerPool" type="MagentoPaymentGatewayConfigValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">TestFinaceConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="TestFinaceConfigValueHandler" type="MagentoPaymentGatewayConfigConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">TestFinanceConfig</argument>
</arguments>
</virtualType>

<type name="TestCapitalFinanceBlockInfo">
<arguments>
<argument name="config" xsi:type="object">TestFinanceConfig</argument>
</arguments>
</type>

</config>



TestCapital/Finance/Model/CustomConfigProvider.php




namespace TestCapitalFinanceModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoFrameworkEscaper;
use MagentoPaymentHelperData as PaymentHelper;

class CustomConfigProvider implements ConfigProviderInterface

const METHOD_CODE = 'test_finance';

public function getConfig()
$config = [
'payment' => array (
self::METHOD_CODE => array (
'storedCards' => $this->getStoredCards(),
)
)
];
return $config;


public function getStoredCards()
$result = array();
$result['0'] = "Test";
$result['1'] = "Test1";
return $result;






TestCapital/Finance/view/frontend/web/js/view/payment/method-renderer/test-finance-method.js




getStoreCard: function() 
return window.checkoutConfig.payment.test_finance.storedCards;
,



TestCapital/Finance/view/frontend/web/template/payment/omni_finance.html




<label>Select Finance Package</label>
<select name="payment[subscription_id]" class="select input-text required-entry"
data-bind="
attr: id: getCode()+'_payment_profile_id',
options: getCardList(),
optionsValue: 'value',
optionsText: 'type',
optionsCaption: $t('--Please Select A Package--'),
">
</select>









share|improve this question


























  • Try with js, return window.checkoutConfig.payment.test_finance.storedCards;

    – Rakesh Jesadiya
    Oct 31 '17 at 8:34











  • use testFinance instead of test_finance

    – Rakesh Jesadiya
    Oct 31 '17 at 9:10

















1















I have followed sample-module-payment-gateway to implement Payment method in Magento 2.



But for some strange reason, Custom Config Provider in Magento is not working. It throws Following error :




TypeError: window.checkoutConfig.payment.test_finance is undefined



Here is the di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="Test_finance" xsi:type="object">TestCapitalFinanceModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

<virtualType name="TestFinanceFacade" type="MagentoPaymentModelMethodAdapter">
<arguments>
<argument name="code" xsi:type="const">TestCapitalFinanceModelPaymentTestFinance::METHOD_CODE</argument>
<argument name="formBlockType" xsi:type="string">TestCapitalFinanceBlockForm</argument>
<argument name="infoBlockType" xsi:type="string">TestCapitalFinanceBlockInfo</argument>
<argument name="valueHandlerPool" xsi:type="object">TestCapitalValueHandlerPool</argument>
<!-- argument name="validatorPool" xsi:type="object">TestCapitalValidatorPool</argument -->
<!-- argument name="commandPool" xsi:type="object">TestCapitalCommandPool</argument -->
</arguments>
</virtualType>

<virtualType name="TestFinanceConfig" type="MagentoPaymentGatewayConfigConfig">
<arguments>
<argument name="test_finance" xsi:type="const">TestCapitalFinanceModelCustomConfigProvider::METHOD_CODE</argument>
</arguments>
</virtualType>

<!-- Value handlers infrastructure -->
<virtualType name="TestFinaceGatewayValueHandlerPool" type="MagentoPaymentGatewayConfigValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">TestFinaceConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="TestFinaceConfigValueHandler" type="MagentoPaymentGatewayConfigConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">TestFinanceConfig</argument>
</arguments>
</virtualType>

<type name="TestCapitalFinanceBlockInfo">
<arguments>
<argument name="config" xsi:type="object">TestFinanceConfig</argument>
</arguments>
</type>

</config>



TestCapital/Finance/Model/CustomConfigProvider.php




namespace TestCapitalFinanceModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoFrameworkEscaper;
use MagentoPaymentHelperData as PaymentHelper;

class CustomConfigProvider implements ConfigProviderInterface

const METHOD_CODE = 'test_finance';

public function getConfig()
$config = [
'payment' => array (
self::METHOD_CODE => array (
'storedCards' => $this->getStoredCards(),
)
)
];
return $config;


public function getStoredCards()
$result = array();
$result['0'] = "Test";
$result['1'] = "Test1";
return $result;






TestCapital/Finance/view/frontend/web/js/view/payment/method-renderer/test-finance-method.js




getStoreCard: function() 
return window.checkoutConfig.payment.test_finance.storedCards;
,



TestCapital/Finance/view/frontend/web/template/payment/omni_finance.html




<label>Select Finance Package</label>
<select name="payment[subscription_id]" class="select input-text required-entry"
data-bind="
attr: id: getCode()+'_payment_profile_id',
options: getCardList(),
optionsValue: 'value',
optionsText: 'type',
optionsCaption: $t('--Please Select A Package--'),
">
</select>









share|improve this question


























  • Try with js, return window.checkoutConfig.payment.test_finance.storedCards;

    – Rakesh Jesadiya
    Oct 31 '17 at 8:34











  • use testFinance instead of test_finance

    – Rakesh Jesadiya
    Oct 31 '17 at 9:10













1












1








1








I have followed sample-module-payment-gateway to implement Payment method in Magento 2.



But for some strange reason, Custom Config Provider in Magento is not working. It throws Following error :




TypeError: window.checkoutConfig.payment.test_finance is undefined



Here is the di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="Test_finance" xsi:type="object">TestCapitalFinanceModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

<virtualType name="TestFinanceFacade" type="MagentoPaymentModelMethodAdapter">
<arguments>
<argument name="code" xsi:type="const">TestCapitalFinanceModelPaymentTestFinance::METHOD_CODE</argument>
<argument name="formBlockType" xsi:type="string">TestCapitalFinanceBlockForm</argument>
<argument name="infoBlockType" xsi:type="string">TestCapitalFinanceBlockInfo</argument>
<argument name="valueHandlerPool" xsi:type="object">TestCapitalValueHandlerPool</argument>
<!-- argument name="validatorPool" xsi:type="object">TestCapitalValidatorPool</argument -->
<!-- argument name="commandPool" xsi:type="object">TestCapitalCommandPool</argument -->
</arguments>
</virtualType>

<virtualType name="TestFinanceConfig" type="MagentoPaymentGatewayConfigConfig">
<arguments>
<argument name="test_finance" xsi:type="const">TestCapitalFinanceModelCustomConfigProvider::METHOD_CODE</argument>
</arguments>
</virtualType>

<!-- Value handlers infrastructure -->
<virtualType name="TestFinaceGatewayValueHandlerPool" type="MagentoPaymentGatewayConfigValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">TestFinaceConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="TestFinaceConfigValueHandler" type="MagentoPaymentGatewayConfigConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">TestFinanceConfig</argument>
</arguments>
</virtualType>

<type name="TestCapitalFinanceBlockInfo">
<arguments>
<argument name="config" xsi:type="object">TestFinanceConfig</argument>
</arguments>
</type>

</config>



TestCapital/Finance/Model/CustomConfigProvider.php




namespace TestCapitalFinanceModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoFrameworkEscaper;
use MagentoPaymentHelperData as PaymentHelper;

class CustomConfigProvider implements ConfigProviderInterface

const METHOD_CODE = 'test_finance';

public function getConfig()
$config = [
'payment' => array (
self::METHOD_CODE => array (
'storedCards' => $this->getStoredCards(),
)
)
];
return $config;


public function getStoredCards()
$result = array();
$result['0'] = "Test";
$result['1'] = "Test1";
return $result;






TestCapital/Finance/view/frontend/web/js/view/payment/method-renderer/test-finance-method.js




getStoreCard: function() 
return window.checkoutConfig.payment.test_finance.storedCards;
,



TestCapital/Finance/view/frontend/web/template/payment/omni_finance.html




<label>Select Finance Package</label>
<select name="payment[subscription_id]" class="select input-text required-entry"
data-bind="
attr: id: getCode()+'_payment_profile_id',
options: getCardList(),
optionsValue: 'value',
optionsText: 'type',
optionsCaption: $t('--Please Select A Package--'),
">
</select>









share|improve this question
















I have followed sample-module-payment-gateway to implement Payment method in Magento 2.



But for some strange reason, Custom Config Provider in Magento is not working. It throws Following error :




TypeError: window.checkoutConfig.payment.test_finance is undefined



Here is the di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="Test_finance" xsi:type="object">TestCapitalFinanceModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

<virtualType name="TestFinanceFacade" type="MagentoPaymentModelMethodAdapter">
<arguments>
<argument name="code" xsi:type="const">TestCapitalFinanceModelPaymentTestFinance::METHOD_CODE</argument>
<argument name="formBlockType" xsi:type="string">TestCapitalFinanceBlockForm</argument>
<argument name="infoBlockType" xsi:type="string">TestCapitalFinanceBlockInfo</argument>
<argument name="valueHandlerPool" xsi:type="object">TestCapitalValueHandlerPool</argument>
<!-- argument name="validatorPool" xsi:type="object">TestCapitalValidatorPool</argument -->
<!-- argument name="commandPool" xsi:type="object">TestCapitalCommandPool</argument -->
</arguments>
</virtualType>

<virtualType name="TestFinanceConfig" type="MagentoPaymentGatewayConfigConfig">
<arguments>
<argument name="test_finance" xsi:type="const">TestCapitalFinanceModelCustomConfigProvider::METHOD_CODE</argument>
</arguments>
</virtualType>

<!-- Value handlers infrastructure -->
<virtualType name="TestFinaceGatewayValueHandlerPool" type="MagentoPaymentGatewayConfigValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">TestFinaceConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="TestFinaceConfigValueHandler" type="MagentoPaymentGatewayConfigConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">TestFinanceConfig</argument>
</arguments>
</virtualType>

<type name="TestCapitalFinanceBlockInfo">
<arguments>
<argument name="config" xsi:type="object">TestFinanceConfig</argument>
</arguments>
</type>

</config>



TestCapital/Finance/Model/CustomConfigProvider.php




namespace TestCapitalFinanceModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoFrameworkEscaper;
use MagentoPaymentHelperData as PaymentHelper;

class CustomConfigProvider implements ConfigProviderInterface

const METHOD_CODE = 'test_finance';

public function getConfig()
$config = [
'payment' => array (
self::METHOD_CODE => array (
'storedCards' => $this->getStoredCards(),
)
)
];
return $config;


public function getStoredCards()
$result = array();
$result['0'] = "Test";
$result['1'] = "Test1";
return $result;






TestCapital/Finance/view/frontend/web/js/view/payment/method-renderer/test-finance-method.js




getStoreCard: function() 
return window.checkoutConfig.payment.test_finance.storedCards;
,



TestCapital/Finance/view/frontend/web/template/payment/omni_finance.html




<label>Select Finance Package</label>
<select name="payment[subscription_id]" class="select input-text required-entry"
data-bind="
attr: id: getCode()+'_payment_profile_id',
options: getCardList(),
optionsValue: 'value',
optionsText: 'type',
optionsCaption: $t('--Please Select A Package--'),
">
</select>






magento2 configuration payment-methods






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 31 '17 at 9:08







JItendra Rana

















asked Oct 31 '17 at 8:31









JItendra RanaJItendra Rana

843 silver badges17 bronze badges




843 silver badges17 bronze badges















  • Try with js, return window.checkoutConfig.payment.test_finance.storedCards;

    – Rakesh Jesadiya
    Oct 31 '17 at 8:34











  • use testFinance instead of test_finance

    – Rakesh Jesadiya
    Oct 31 '17 at 9:10

















  • Try with js, return window.checkoutConfig.payment.test_finance.storedCards;

    – Rakesh Jesadiya
    Oct 31 '17 at 8:34











  • use testFinance instead of test_finance

    – Rakesh Jesadiya
    Oct 31 '17 at 9:10
















Try with js, return window.checkoutConfig.payment.test_finance.storedCards;

– Rakesh Jesadiya
Oct 31 '17 at 8:34





Try with js, return window.checkoutConfig.payment.test_finance.storedCards;

– Rakesh Jesadiya
Oct 31 '17 at 8:34













use testFinance instead of test_finance

– Rakesh Jesadiya
Oct 31 '17 at 9:10





use testFinance instead of test_finance

– Rakesh Jesadiya
Oct 31 '17 at 9:10










2 Answers
2






active

oldest

votes


















2














Eventually got this Resolved.



I had misplaced di.xml

once i moved di.xml to etc/frontend folder everything works fine now.



Anyone looking for this, Here is the correct location for di.xml




Namespace/Modulename/etc/frontend/di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="custom_payment_config_provider" xsi:type="object">NamespaceModulenameModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

</config>



Namespace/Modulename/Model/CustomConfigProvider.php




namespace NamespaceModulenameModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoSamplePaymentGatewayGatewayHttpClientClientMock;

class CustomConfigProvider implements ConfigProviderInterface
public function getConfig()
$config = array();
return $config;







share|improve this answer

























  • This is a total stupid thing, I do not understand why Magento can not use it from the etc directory. I sucked an hour with this while I found your solution.

    – vaso123
    Feb 13 at 10:48


















1














You need to set your js file as below,



window.checkoutConfig.payment.testFinance.storedCards


Set your js file code,



getStoreCard: function() 
return window.checkoutConfig.payment.testFinance.storedCards
,


Run



php bin/magento setup:upgrade,
php bin/magento setup:static-content:deploy





share|improve this answer

























  • Why what is wrong with an underscore? Is it naming convention?

    – JItendra Rana
    Oct 31 '17 at 9:10











  • Yes you have to keep naming convention with code.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:12











  • So do I need to change that in COnfigPrivder class as well? 'payment' => array ( 'test_finance' => array ( 'storedCards' => $this->getStoredCards(), ) )

    – JItendra Rana
    Oct 31 '17 at 9:14












  • Its better to change at those points also.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:15











  • Its not the case. The config Provider class is not being called. There is some misconfiguration in di.xml

    – JItendra Rana
    Oct 31 '17 at 9:18













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f199388%2fmagento-2-payment-config-provider-not-working%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Eventually got this Resolved.



I had misplaced di.xml

once i moved di.xml to etc/frontend folder everything works fine now.



Anyone looking for this, Here is the correct location for di.xml




Namespace/Modulename/etc/frontend/di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="custom_payment_config_provider" xsi:type="object">NamespaceModulenameModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

</config>



Namespace/Modulename/Model/CustomConfigProvider.php




namespace NamespaceModulenameModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoSamplePaymentGatewayGatewayHttpClientClientMock;

class CustomConfigProvider implements ConfigProviderInterface
public function getConfig()
$config = array();
return $config;







share|improve this answer

























  • This is a total stupid thing, I do not understand why Magento can not use it from the etc directory. I sucked an hour with this while I found your solution.

    – vaso123
    Feb 13 at 10:48















2














Eventually got this Resolved.



I had misplaced di.xml

once i moved di.xml to etc/frontend folder everything works fine now.



Anyone looking for this, Here is the correct location for di.xml




Namespace/Modulename/etc/frontend/di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="custom_payment_config_provider" xsi:type="object">NamespaceModulenameModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

</config>



Namespace/Modulename/Model/CustomConfigProvider.php




namespace NamespaceModulenameModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoSamplePaymentGatewayGatewayHttpClientClientMock;

class CustomConfigProvider implements ConfigProviderInterface
public function getConfig()
$config = array();
return $config;







share|improve this answer

























  • This is a total stupid thing, I do not understand why Magento can not use it from the etc directory. I sucked an hour with this while I found your solution.

    – vaso123
    Feb 13 at 10:48













2












2








2







Eventually got this Resolved.



I had misplaced di.xml

once i moved di.xml to etc/frontend folder everything works fine now.



Anyone looking for this, Here is the correct location for di.xml




Namespace/Modulename/etc/frontend/di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="custom_payment_config_provider" xsi:type="object">NamespaceModulenameModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

</config>



Namespace/Modulename/Model/CustomConfigProvider.php




namespace NamespaceModulenameModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoSamplePaymentGatewayGatewayHttpClientClientMock;

class CustomConfigProvider implements ConfigProviderInterface
public function getConfig()
$config = array();
return $config;







share|improve this answer













Eventually got this Resolved.



I had misplaced di.xml

once i moved di.xml to etc/frontend folder everything works fine now.



Anyone looking for this, Here is the correct location for di.xml




Namespace/Modulename/etc/frontend/di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoCheckoutModelCompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="custom_payment_config_provider" xsi:type="object">NamespaceModulenameModelCustomConfigProvider</item>
</argument>
</arguments>
</type>

</config>



Namespace/Modulename/Model/CustomConfigProvider.php




namespace NamespaceModulenameModel;

use MagentoCheckoutModelConfigProviderInterface;
use MagentoSamplePaymentGatewayGatewayHttpClientClientMock;

class CustomConfigProvider implements ConfigProviderInterface
public function getConfig()
$config = array();
return $config;








share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 2 '17 at 6:41









JItendra RanaJItendra Rana

843 silver badges17 bronze badges




843 silver badges17 bronze badges















  • This is a total stupid thing, I do not understand why Magento can not use it from the etc directory. I sucked an hour with this while I found your solution.

    – vaso123
    Feb 13 at 10:48

















  • This is a total stupid thing, I do not understand why Magento can not use it from the etc directory. I sucked an hour with this while I found your solution.

    – vaso123
    Feb 13 at 10:48
















This is a total stupid thing, I do not understand why Magento can not use it from the etc directory. I sucked an hour with this while I found your solution.

– vaso123
Feb 13 at 10:48





This is a total stupid thing, I do not understand why Magento can not use it from the etc directory. I sucked an hour with this while I found your solution.

– vaso123
Feb 13 at 10:48













1














You need to set your js file as below,



window.checkoutConfig.payment.testFinance.storedCards


Set your js file code,



getStoreCard: function() 
return window.checkoutConfig.payment.testFinance.storedCards
,


Run



php bin/magento setup:upgrade,
php bin/magento setup:static-content:deploy





share|improve this answer

























  • Why what is wrong with an underscore? Is it naming convention?

    – JItendra Rana
    Oct 31 '17 at 9:10











  • Yes you have to keep naming convention with code.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:12











  • So do I need to change that in COnfigPrivder class as well? 'payment' => array ( 'test_finance' => array ( 'storedCards' => $this->getStoredCards(), ) )

    – JItendra Rana
    Oct 31 '17 at 9:14












  • Its better to change at those points also.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:15











  • Its not the case. The config Provider class is not being called. There is some misconfiguration in di.xml

    – JItendra Rana
    Oct 31 '17 at 9:18















1














You need to set your js file as below,



window.checkoutConfig.payment.testFinance.storedCards


Set your js file code,



getStoreCard: function() 
return window.checkoutConfig.payment.testFinance.storedCards
,


Run



php bin/magento setup:upgrade,
php bin/magento setup:static-content:deploy





share|improve this answer

























  • Why what is wrong with an underscore? Is it naming convention?

    – JItendra Rana
    Oct 31 '17 at 9:10











  • Yes you have to keep naming convention with code.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:12











  • So do I need to change that in COnfigPrivder class as well? 'payment' => array ( 'test_finance' => array ( 'storedCards' => $this->getStoredCards(), ) )

    – JItendra Rana
    Oct 31 '17 at 9:14












  • Its better to change at those points also.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:15











  • Its not the case. The config Provider class is not being called. There is some misconfiguration in di.xml

    – JItendra Rana
    Oct 31 '17 at 9:18













1












1








1







You need to set your js file as below,



window.checkoutConfig.payment.testFinance.storedCards


Set your js file code,



getStoreCard: function() 
return window.checkoutConfig.payment.testFinance.storedCards
,


Run



php bin/magento setup:upgrade,
php bin/magento setup:static-content:deploy





share|improve this answer













You need to set your js file as below,



window.checkoutConfig.payment.testFinance.storedCards


Set your js file code,



getStoreCard: function() 
return window.checkoutConfig.payment.testFinance.storedCards
,


Run



php bin/magento setup:upgrade,
php bin/magento setup:static-content:deploy






share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 31 '17 at 8:57









Rakesh JesadiyaRakesh Jesadiya

31.6k15 gold badges82 silver badges136 bronze badges




31.6k15 gold badges82 silver badges136 bronze badges















  • Why what is wrong with an underscore? Is it naming convention?

    – JItendra Rana
    Oct 31 '17 at 9:10











  • Yes you have to keep naming convention with code.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:12











  • So do I need to change that in COnfigPrivder class as well? 'payment' => array ( 'test_finance' => array ( 'storedCards' => $this->getStoredCards(), ) )

    – JItendra Rana
    Oct 31 '17 at 9:14












  • Its better to change at those points also.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:15











  • Its not the case. The config Provider class is not being called. There is some misconfiguration in di.xml

    – JItendra Rana
    Oct 31 '17 at 9:18

















  • Why what is wrong with an underscore? Is it naming convention?

    – JItendra Rana
    Oct 31 '17 at 9:10











  • Yes you have to keep naming convention with code.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:12











  • So do I need to change that in COnfigPrivder class as well? 'payment' => array ( 'test_finance' => array ( 'storedCards' => $this->getStoredCards(), ) )

    – JItendra Rana
    Oct 31 '17 at 9:14












  • Its better to change at those points also.

    – Rakesh Jesadiya
    Oct 31 '17 at 9:15











  • Its not the case. The config Provider class is not being called. There is some misconfiguration in di.xml

    – JItendra Rana
    Oct 31 '17 at 9:18
















Why what is wrong with an underscore? Is it naming convention?

– JItendra Rana
Oct 31 '17 at 9:10





Why what is wrong with an underscore? Is it naming convention?

– JItendra Rana
Oct 31 '17 at 9:10













Yes you have to keep naming convention with code.

– Rakesh Jesadiya
Oct 31 '17 at 9:12





Yes you have to keep naming convention with code.

– Rakesh Jesadiya
Oct 31 '17 at 9:12













So do I need to change that in COnfigPrivder class as well? 'payment' => array ( 'test_finance' => array ( 'storedCards' => $this->getStoredCards(), ) )

– JItendra Rana
Oct 31 '17 at 9:14






So do I need to change that in COnfigPrivder class as well? 'payment' => array ( 'test_finance' => array ( 'storedCards' => $this->getStoredCards(), ) )

– JItendra Rana
Oct 31 '17 at 9:14














Its better to change at those points also.

– Rakesh Jesadiya
Oct 31 '17 at 9:15





Its better to change at those points also.

– Rakesh Jesadiya
Oct 31 '17 at 9:15













Its not the case. The config Provider class is not being called. There is some misconfiguration in di.xml

– JItendra Rana
Oct 31 '17 at 9:18





Its not the case. The config Provider class is not being called. There is some misconfiguration in di.xml

– JItendra Rana
Oct 31 '17 at 9:18

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f199388%2fmagento-2-payment-config-provider-not-working%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?