Custom payment method is not showing in checkout Magento 2.2.3












0















I am new to Magento.I have created a payment method but it is not showing in checkout page. It is showing in Magento Admin Panel.




etc/adminhtml/system.xml




<?xml version="1.0"?>
<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">
<group id="Newpayment" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Newpayment</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
</field>
<field id="int_id" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant ID</label>
</field>
<field id="mer_id" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant Settlement ID</label>
</field>
<field id="mer_dis_name" translate="label" type="text" sortOrder="23" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant Display Name</label>
</field>
<field id="merchant_priv_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Private Key</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
<field id="merchant_pub_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Public Key</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
<field id="api_key" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>API Key</label>
</field>
<field id="debug" translate="label" type="select" sortOrder="85" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Debug</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="environment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Environment</label>
<source_model>MagentoNewpaymentModelEnvironment</source_model>
<config_path>payment/Newpayment/environment</config_path>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="160" showInDefault="1" showInWebsite="1"
showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
</field>
</group>
</section>
</system>
</config>



etc/config.xml




<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<Newpayment>
<debug>1</debug>
<active>1</active>
<model>MagentoNewpaymentModelNewpayment</model>
<sandbox_url>https://test.Newpayment.com/pg/pay</sandbox_url>
<production_url>https://secure.Newpayment.com/pg/pay</production_url>
<environment>sandbox</environment>
<merchant_priv_key backend_model="MagentoConfigModelConfigBackendEncrypted" />
<merchant_pub_key backend_model="MagentoConfigModelConfigBackendEncrypted" />
<order_status>pending_payment</order_status>
<title>Payment method (Newpayment)</title>
<currency>INR</currency>
<can_authorize>0</can_authorize>
<can_capture>1</can_capture>
<can_void>0</can_void>
<can_use_checkout>1</can_use_checkout>
<is_gateway>1</is_gateway>
<sort_order>1</sort_order>
<redirect_url>Newpayment/standard/redirect</redirect_url>
<return_url>Newpayment/standard/response</return_url>
<cancel_url>Newpayment/standard/cancel</cancel_url>
</Newpayment>
</payment>
</default>
</config>



etc/module.xml




<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Newpayment" setup_version="2.0.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
<module name="Magento_Checkout"/>
</sequence>
</module>
</config>



etc/payment.xml




<?xml version="1.0"?>

<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment:etc/payment.xsd">
<methods>
<method name="Newpayment">
<allow_multiple_address>1</allow_multiple_address>
</method>
</methods>
</payment>



view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="renders" xsi:type="array">
<!-- merge payment method renders here -->
<item name="children" xsi:type="array">
<item name="Newpayment" xsi:type="array">
<item name="component" xsi:type="string">Magento_Newpayment/js/view/payment/Newpayment</item>
<item name="methods" xsi:type="array">
<item name="Newpayment" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



view/frontend/web/js/view/payment/method-render/Newpayment.js




define(
[
'Magento_Checkout/js/view/payment/default',
'Magento_Newpayment/js/action/set-payment-method',
],
function (Component,setPaymentMethod) {
'use strict';

return Component.extend({
defaults: {
template: 'Magento_Newpayment/payment/form',
},
redirectAfterPlaceOrder: false,

afterPlaceOrder: function(){
setPaymentMethod();
}
});
}
);



view/frontend/web/js/view/payment/Newpayment.js




define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'Newpayment',
component: 'Magento_Newpayment/js/view/payment/method-renderer/Newpayment'
}
);
return Component.extend({});
}
);



view/frontend/web/template/payment/form.html




<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
class="radio"
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
<label class="label" data-bind="attr: {'for': getCode()}">
<span data-bind="text: getTitle()"></span>
</label>
</div>

<div class="payment-method-content">
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>

<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked())
" disabled>
<span data-bind="i18n: 'Continue'"></span>
</button>
</div>
</div>
</div>
</div>



registration.php




<?php

MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Magento_Newpayment',
__DIR__
);








share







New contributor




Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Now install this module execute php bin/magento setup:upgarde command in your root.

    – Rv Singh
    41 secs ago
















0















I am new to Magento.I have created a payment method but it is not showing in checkout page. It is showing in Magento Admin Panel.




etc/adminhtml/system.xml




<?xml version="1.0"?>
<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">
<group id="Newpayment" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Newpayment</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
</field>
<field id="int_id" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant ID</label>
</field>
<field id="mer_id" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant Settlement ID</label>
</field>
<field id="mer_dis_name" translate="label" type="text" sortOrder="23" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant Display Name</label>
</field>
<field id="merchant_priv_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Private Key</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
<field id="merchant_pub_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Public Key</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
<field id="api_key" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>API Key</label>
</field>
<field id="debug" translate="label" type="select" sortOrder="85" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Debug</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="environment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Environment</label>
<source_model>MagentoNewpaymentModelEnvironment</source_model>
<config_path>payment/Newpayment/environment</config_path>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="160" showInDefault="1" showInWebsite="1"
showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
</field>
</group>
</section>
</system>
</config>



etc/config.xml




<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<Newpayment>
<debug>1</debug>
<active>1</active>
<model>MagentoNewpaymentModelNewpayment</model>
<sandbox_url>https://test.Newpayment.com/pg/pay</sandbox_url>
<production_url>https://secure.Newpayment.com/pg/pay</production_url>
<environment>sandbox</environment>
<merchant_priv_key backend_model="MagentoConfigModelConfigBackendEncrypted" />
<merchant_pub_key backend_model="MagentoConfigModelConfigBackendEncrypted" />
<order_status>pending_payment</order_status>
<title>Payment method (Newpayment)</title>
<currency>INR</currency>
<can_authorize>0</can_authorize>
<can_capture>1</can_capture>
<can_void>0</can_void>
<can_use_checkout>1</can_use_checkout>
<is_gateway>1</is_gateway>
<sort_order>1</sort_order>
<redirect_url>Newpayment/standard/redirect</redirect_url>
<return_url>Newpayment/standard/response</return_url>
<cancel_url>Newpayment/standard/cancel</cancel_url>
</Newpayment>
</payment>
</default>
</config>



etc/module.xml




<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Newpayment" setup_version="2.0.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
<module name="Magento_Checkout"/>
</sequence>
</module>
</config>



etc/payment.xml




<?xml version="1.0"?>

<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment:etc/payment.xsd">
<methods>
<method name="Newpayment">
<allow_multiple_address>1</allow_multiple_address>
</method>
</methods>
</payment>



view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="renders" xsi:type="array">
<!-- merge payment method renders here -->
<item name="children" xsi:type="array">
<item name="Newpayment" xsi:type="array">
<item name="component" xsi:type="string">Magento_Newpayment/js/view/payment/Newpayment</item>
<item name="methods" xsi:type="array">
<item name="Newpayment" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



view/frontend/web/js/view/payment/method-render/Newpayment.js




define(
[
'Magento_Checkout/js/view/payment/default',
'Magento_Newpayment/js/action/set-payment-method',
],
function (Component,setPaymentMethod) {
'use strict';

return Component.extend({
defaults: {
template: 'Magento_Newpayment/payment/form',
},
redirectAfterPlaceOrder: false,

afterPlaceOrder: function(){
setPaymentMethod();
}
});
}
);



view/frontend/web/js/view/payment/Newpayment.js




define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'Newpayment',
component: 'Magento_Newpayment/js/view/payment/method-renderer/Newpayment'
}
);
return Component.extend({});
}
);



view/frontend/web/template/payment/form.html




<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
class="radio"
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
<label class="label" data-bind="attr: {'for': getCode()}">
<span data-bind="text: getTitle()"></span>
</label>
</div>

<div class="payment-method-content">
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>

<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked())
" disabled>
<span data-bind="i18n: 'Continue'"></span>
</button>
</div>
</div>
</div>
</div>



registration.php




<?php

MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Magento_Newpayment',
__DIR__
);








share







New contributor




Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Now install this module execute php bin/magento setup:upgarde command in your root.

    – Rv Singh
    41 secs ago














0












0








0








I am new to Magento.I have created a payment method but it is not showing in checkout page. It is showing in Magento Admin Panel.




etc/adminhtml/system.xml




<?xml version="1.0"?>
<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">
<group id="Newpayment" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Newpayment</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
</field>
<field id="int_id" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant ID</label>
</field>
<field id="mer_id" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant Settlement ID</label>
</field>
<field id="mer_dis_name" translate="label" type="text" sortOrder="23" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant Display Name</label>
</field>
<field id="merchant_priv_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Private Key</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
<field id="merchant_pub_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Public Key</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
<field id="api_key" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>API Key</label>
</field>
<field id="debug" translate="label" type="select" sortOrder="85" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Debug</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="environment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Environment</label>
<source_model>MagentoNewpaymentModelEnvironment</source_model>
<config_path>payment/Newpayment/environment</config_path>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="160" showInDefault="1" showInWebsite="1"
showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
</field>
</group>
</section>
</system>
</config>



etc/config.xml




<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<Newpayment>
<debug>1</debug>
<active>1</active>
<model>MagentoNewpaymentModelNewpayment</model>
<sandbox_url>https://test.Newpayment.com/pg/pay</sandbox_url>
<production_url>https://secure.Newpayment.com/pg/pay</production_url>
<environment>sandbox</environment>
<merchant_priv_key backend_model="MagentoConfigModelConfigBackendEncrypted" />
<merchant_pub_key backend_model="MagentoConfigModelConfigBackendEncrypted" />
<order_status>pending_payment</order_status>
<title>Payment method (Newpayment)</title>
<currency>INR</currency>
<can_authorize>0</can_authorize>
<can_capture>1</can_capture>
<can_void>0</can_void>
<can_use_checkout>1</can_use_checkout>
<is_gateway>1</is_gateway>
<sort_order>1</sort_order>
<redirect_url>Newpayment/standard/redirect</redirect_url>
<return_url>Newpayment/standard/response</return_url>
<cancel_url>Newpayment/standard/cancel</cancel_url>
</Newpayment>
</payment>
</default>
</config>



etc/module.xml




<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Newpayment" setup_version="2.0.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
<module name="Magento_Checkout"/>
</sequence>
</module>
</config>



etc/payment.xml




<?xml version="1.0"?>

<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment:etc/payment.xsd">
<methods>
<method name="Newpayment">
<allow_multiple_address>1</allow_multiple_address>
</method>
</methods>
</payment>



view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="renders" xsi:type="array">
<!-- merge payment method renders here -->
<item name="children" xsi:type="array">
<item name="Newpayment" xsi:type="array">
<item name="component" xsi:type="string">Magento_Newpayment/js/view/payment/Newpayment</item>
<item name="methods" xsi:type="array">
<item name="Newpayment" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



view/frontend/web/js/view/payment/method-render/Newpayment.js




define(
[
'Magento_Checkout/js/view/payment/default',
'Magento_Newpayment/js/action/set-payment-method',
],
function (Component,setPaymentMethod) {
'use strict';

return Component.extend({
defaults: {
template: 'Magento_Newpayment/payment/form',
},
redirectAfterPlaceOrder: false,

afterPlaceOrder: function(){
setPaymentMethod();
}
});
}
);



view/frontend/web/js/view/payment/Newpayment.js




define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'Newpayment',
component: 'Magento_Newpayment/js/view/payment/method-renderer/Newpayment'
}
);
return Component.extend({});
}
);



view/frontend/web/template/payment/form.html




<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
class="radio"
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
<label class="label" data-bind="attr: {'for': getCode()}">
<span data-bind="text: getTitle()"></span>
</label>
</div>

<div class="payment-method-content">
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>

<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked())
" disabled>
<span data-bind="i18n: 'Continue'"></span>
</button>
</div>
</div>
</div>
</div>



registration.php




<?php

MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Magento_Newpayment',
__DIR__
);








share







New contributor




Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I am new to Magento.I have created a payment method but it is not showing in checkout page. It is showing in Magento Admin Panel.




etc/adminhtml/system.xml




<?xml version="1.0"?>
<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">
<group id="Newpayment" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Newpayment</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enabled</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
</field>
<field id="int_id" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant ID</label>
</field>
<field id="mer_id" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant Settlement ID</label>
</field>
<field id="mer_dis_name" translate="label" type="text" sortOrder="23" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Merchant Display Name</label>
</field>
<field id="merchant_priv_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Private Key</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
<field id="merchant_pub_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Public Key</label>
<backend_model>MagentoConfigModelConfigBackendEncrypted</backend_model>
</field>
<field id="api_key" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>API Key</label>
</field>
<field id="debug" translate="label" type="select" sortOrder="85" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Debug</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="environment" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Environment</label>
<source_model>MagentoNewpaymentModelEnvironment</source_model>
<config_path>payment/Newpayment/environment</config_path>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="160" showInDefault="1" showInWebsite="1"
showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
</field>
</group>
</section>
</system>
</config>



etc/config.xml




<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<Newpayment>
<debug>1</debug>
<active>1</active>
<model>MagentoNewpaymentModelNewpayment</model>
<sandbox_url>https://test.Newpayment.com/pg/pay</sandbox_url>
<production_url>https://secure.Newpayment.com/pg/pay</production_url>
<environment>sandbox</environment>
<merchant_priv_key backend_model="MagentoConfigModelConfigBackendEncrypted" />
<merchant_pub_key backend_model="MagentoConfigModelConfigBackendEncrypted" />
<order_status>pending_payment</order_status>
<title>Payment method (Newpayment)</title>
<currency>INR</currency>
<can_authorize>0</can_authorize>
<can_capture>1</can_capture>
<can_void>0</can_void>
<can_use_checkout>1</can_use_checkout>
<is_gateway>1</is_gateway>
<sort_order>1</sort_order>
<redirect_url>Newpayment/standard/redirect</redirect_url>
<return_url>Newpayment/standard/response</return_url>
<cancel_url>Newpayment/standard/cancel</cancel_url>
</Newpayment>
</payment>
</default>
</config>



etc/module.xml




<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Newpayment" setup_version="2.0.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
<module name="Magento_Checkout"/>
</sequence>
</module>
</config>



etc/payment.xml




<?xml version="1.0"?>

<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment:etc/payment.xsd">
<methods>
<method name="Newpayment">
<allow_multiple_address>1</allow_multiple_address>
</method>
</methods>
</payment>



view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="renders" xsi:type="array">
<!-- merge payment method renders here -->
<item name="children" xsi:type="array">
<item name="Newpayment" xsi:type="array">
<item name="component" xsi:type="string">Magento_Newpayment/js/view/payment/Newpayment</item>
<item name="methods" xsi:type="array">
<item name="Newpayment" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



view/frontend/web/js/view/payment/method-render/Newpayment.js




define(
[
'Magento_Checkout/js/view/payment/default',
'Magento_Newpayment/js/action/set-payment-method',
],
function (Component,setPaymentMethod) {
'use strict';

return Component.extend({
defaults: {
template: 'Magento_Newpayment/payment/form',
},
redirectAfterPlaceOrder: false,

afterPlaceOrder: function(){
setPaymentMethod();
}
});
}
);



view/frontend/web/js/view/payment/Newpayment.js




define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'Newpayment',
component: 'Magento_Newpayment/js/view/payment/method-renderer/Newpayment'
}
);
return Component.extend({});
}
);



view/frontend/web/template/payment/form.html




<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
class="radio"
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
<label class="label" data-bind="attr: {'for': getCode()}">
<span data-bind="text: getTitle()"></span>
</label>
</div>

<div class="payment-method-content">
<!-- ko foreach: getRegion('messages') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>

<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked())
" disabled>
<span data-bind="i18n: 'Continue'"></span>
</button>
</div>
</div>
</div>
</div>



registration.php




<?php

MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Magento_Newpayment',
__DIR__
);






payment-methods magento2.2.3 checkout-page





share







New contributor




Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share







New contributor




Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share



share






New contributor




Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 mins ago









Swati YadavSwati Yadav

1




1




New contributor




Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Swati Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Now install this module execute php bin/magento setup:upgarde command in your root.

    – Rv Singh
    41 secs ago



















  • Now install this module execute php bin/magento setup:upgarde command in your root.

    – Rv Singh
    41 secs ago

















Now install this module execute php bin/magento setup:upgarde command in your root.

– Rv Singh
41 secs ago





Now install this module execute php bin/magento setup:upgarde command in your root.

– Rv Singh
41 secs ago










0






active

oldest

votes











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
});


}
});






Swati Yadav is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f258116%2fcustom-payment-method-is-not-showing-in-checkout-magento-2-2-3%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








Swati Yadav is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Swati Yadav is a new contributor. Be nice, and check out our Code of Conduct.













Swati Yadav is a new contributor. Be nice, and check out our Code of Conduct.












Swati Yadav is a new contributor. Be nice, and check out our Code of Conduct.
















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%2f258116%2fcustom-payment-method-is-not-showing-in-checkout-magento-2-2-3%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

Polycentropodidae

Magento 2 Error message: Invalid state change requested

Paulmy