I created a credit card form under custom payment method by following this link

I'm getting a sytem.log error

[2019-02-06 06:22:10] main.CRITICAL: Class VendorName\Worldpaydirect\Model\          
Source does not exist [] []


<?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">
        <argument name="configProviders" xsi:type="array">
            <item name="vendorname_worldpaydirect_configprovider" xsi:type="object">VendorName\Worldpaydirect\Model\WorldpaydirectConfigProvider</item>


namespace VendorName\Worldpaydirect\Model;
use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\View\Asset\Source;
class WorldpaydirectConfigProvider implements ConfigProviderInterface
public function __construct(\Magento\Payment\Model\CcConfig $ccConfig,
        Source $assetSource)
$this->ccConfig = $ccConfig;
$this->assetSource = $assetSource;
protected $_methodCode = 'worldpaydirect';
public function getConfig()
return [
'payment' => [
'worldpaydirect' => [
'availableTypes' => [$this->_methodCode => $this->ccConfig->etCcAvailableTypes()],
'months' => [$this->_methodCode => $this->ccConfig->getCcMonths()],
'years' => [$this->_methodCode => $this->ccConfig->getCcYears()],
'hasVerification' => $this->ccConfig->hasVerification(),

Looks like var/generation is not writable here.

Magento 2 generates classes inside var/generation directory. So, if there is folder permission issue or folder owner issue with that directory then the class cannot be generated and you get such error.

When you clear var/generation directory and set appropriate permission to it then this error should be solved.

you have to remove rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/*

after run below command

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush
  • i did but its show VendorName\Worldpaydirect\Model\ Source does not exist @rakesh Feb 6 '19 at 7:37
  • @divyasekar i have updated my answer you can remove and after run above command this sequence Feb 6 '19 at 7:43
  • its not working Feb 6 '19 at 9:52
  • @divyasekar this problem solve i have say but you can check also here magento.stackexchange.com/a/94458/68695 Feb 6 '19 at 9:57

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.