2

I have created a module custom payment method. All is fine except that the custom payment method is not showing in create order page.

File system.xml:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="payment" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="adminpaymentmethod" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Admin Payment Method</label>
                <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                    <label>Enabled</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                     <comment><![CDATA[Version 1.0.0]]></comment>
                </field>
                <field id="title" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Title</label>
                </field>
                <field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                    <label>New Order Status</label>
                    <source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model>
                </field>
                <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                    <label>Payment from Applicable Countries</label>
                    <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
                </field>         
                <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>Payment from Specific Countries</label>
                    <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
                    <can_be_empty>1</can_be_empty>
                </field>
                <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>Sort Order</label>
                    <frontend_class>validate-number</frontend_class>
                </field>
                <field id="default" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                     <comment><![CDATA[Payment  method is automatically selected if existed.]]>
                    </comment>
                </field>
                <field id="model"></field>
            </group>
        </section>
    </system>
</config>

File config.xml:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
        <default>
            <payment>
                <adminpaymentmethod>
                    <model>Bss\AdminPaymentMethod\Model\AdminPaymentMethod</model>
                    <enable>1</enable>
                    <order_status>pending</order_status>
                    <title>Admin Payment Method</title>
                    <allowspecific>0</allowspecific>
                    <default>1</default>
                </adminpaymentmethod>
            </payment>
        </default>
    </config>

File Model\AdminPaymentMethod.php:

class AdminPaymentMethod extends \Magento\Payment\Model\Method\AbstractMethod
{

    protected $_code = 'adminpaymentmethod';

    /**
     * Availability option
     *
     * @var bool
     */
    protected $_isOffline = true;
}

Can anyone help me?

  • please share the code of Bss\AdminPaymentMethod\Model\AdminPaymentMethod – Amit Bera Sep 12 '18 at 15:16
  • @AmitBera i updated my question! – Thành Trung Tô Sep 12 '18 at 15:24
  • @ThànhTrungTô - Do you have payment.xml file located in Bss\AdminPaymentMethod\etc folder? – sandip Sep 12 '18 at 17:02
  • 1
    @sandip i don't have it.Tks u !. I have corrected that error .replace id enable into active. it's work. – Thành Trung Tô Sep 13 '18 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.