Did you implement all parts from the article?
In the article, you can find related code:
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="Magento\Checkout\Model\CompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="test_module_configprovider" xsi:type="object">Test\Module\Model\TestpaymentConfigProvider</item>
</argument>
</arguments>
</type>
</config>
Model/TestpaymentConfigProvider.php
<?php
namespace Test\Module\Model;
use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\View\Asset\Source;
class TestpaymentConfigProvider implements ConfigProviderInterface
{
/**
* @param CcConfig $ccConfig
* @param Source $assetSource
*/
public function __construct(
\Magento\Payment\Model\CcConfig $ccConfig,
Source $assetSource
) {
$this->ccConfig = $ccConfig;
$this->assetSource = $assetSource;
}
/**
* @var string[]
*/
protected $_methodCode = 'testpayment';
/**
* {@inheritdoc}
*/
public function getConfig()
{
return [
'payment' => [
'testpayment' => [
'availableTypes' => [$this->_methodCode => $this->ccConfig->getCcAvailableTypes()],
'months' => [$this->_methodCode => $this->ccConfig->getCcMonths()],
'years' => [$this->_methodCode => $this->ccConfig->getCcYears()],
'hasVerification' => $this->ccConfig->hasVerification(),
]
]
];
}
}
Please double check your ConfigProvider and sure that you are provide custompayment instead of testpayment in example