Magento 2 custom payment method not showing in front end












6














I have tried to create new payment method in magento2, when i tried to configure it is coming in the backend, but not in the front end. If anyone fixed this issue please let me know the fixes, i am not sure the exact reason.




My block form Quickpay.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayBlockForm;

/**
* Block for Quickpay payment method form
*/
class Quickpay extends MagentoQuickpayBlockFormAbstractInstruction
{
/**
* Quick pay template
*
* @var string
*/
protected $_template = 'form/quickpay.phtml';
}



AbstractInstuction.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayBlockForm;

/**
* Abstract class for Quickpay payment method form
*/
abstract class AbstractInstruction extends MagentoPaymentBlockForm
{
/**
* Instructions text
*
* @var string
*/
protected $_instructions;

/**
* Get instructions text from config
*
* @return null|string
*/
public function getInstructions()
{
if ($this->_instructions === null) {
/** @var MagentoPaymentModelMethodAbstractMethod $method */
$method = $this->getMethod();
$this->_instructions = $method->getConfigData('instructions');
}
return $this->_instructions;
}
}



Model : Quickpay.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayModel;

/**
* Quickpay payment method model
*
* @method MagentoQuoteApiDataPaymentMethodExtensionInterface getExtensionAttributes()
*/
class Quickpay extends MagentoPaymentModelMethodAbstractMethod
{
const PAYMENT_METHOD_QUICKPAY_CODE = 'quickpay';

/**
* Payment method code
*
* @var string
*/
protected $_code = self::PAYMENT_METHOD_QUICKPAY_CODE;

/**
* Quickpay payment block paths
*
* @var string
*/
protected $_formBlockType = 'MagentoQuickpayBlockFormQuickpay';

/**
* Info instructions block path
*
* @var string
*/
protected $_infoBlockType = 'MagentoPaymentBlockInfoInstructions';

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

/**
* Get instructions text from config
*
* @return string
*/
public function getInstructions()
{
return trim($this->getConfigData('instructions'));
}
}



view : adminhtml/templates/form/quickpay.html




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* @var $block MagentoQuickpayBlockFormQuickpay
*/
$instructions = $block->getInstructions();
?>
<?php if ($instructions): ?>
<?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
<ul class="form-list checkout-agreements" id="payment_form_<?php /* @noEscape */ echo $methodCode ?>" style="display:none;">
<li>
<div class="<?php /* @noEscape */ echo $methodCode ?>-instructions-content checkout-agreement-item-content">
<?php /* @noEscape */ echo nl2br($block->escapeHtml($instructions)) ?>
</div>
</li>
</ul>
<?php endif; ?>



view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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="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="offline-payments" xsi:type="array">
<item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>
<item name="methods" xsi:type="array">
<item name="quickpay" 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/templates/form/quickpay.phtml




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* @var $block MagentoQuickpayBlockFormQuickpay
*/
$instructions = $block->getInstructions();
?>
<?php if ($instructions): ?>
<?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
<div class="items <?php /* @noEscape */ echo $methodCode ?> instructions agreement" id="payment_form_<?php /* @noEscape */ echo $methodCode ?>" style="display: none;">
<?php /* @noEscape */ echo nl2br($block->escapeHtml($instructions)) ?>
</div>
<?php endif; ?>



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




<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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 data-bind="attr: {'for': getCode()}" class="label"><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>
<p data-bind="html: getInstructions()"></p>
<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()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
disabled>
<span data-bind="i18n: 'Place Order'"></span>
</button>
</div>
</div>

</div>
</div>



js : Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js




/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'quickpay',
component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
}
);
/** Add view logic here if needed */
return Component.extend({});
}
);



quickpay.js : Magento/Quickpay/view/frontend/web/js/view/payment/method-renderer/quickpay.js




/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'Magento_Checkout/js/view/payment/default'
],
function (Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Quickpay/payment/quickpay'
},

/** Returns payment method instructions */
getInstructions: function() {
return window.checkoutConfig.payment.instructions[this.item.method];
}
});
}
);









share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Please update the full path of your js render file?
    – Khoa TruongDinh
    Jun 28 '16 at 13:25










  • Have you got the solution of this, If yes Please mention it here
    – mjdevloper
    Sep 9 '16 at 10:28










  • have you done this?
    – Bojjaiah
    Dec 13 '16 at 10:36










  • @magento two No
    – Naveenbos
    Dec 13 '16 at 13:16
















6














I have tried to create new payment method in magento2, when i tried to configure it is coming in the backend, but not in the front end. If anyone fixed this issue please let me know the fixes, i am not sure the exact reason.




My block form Quickpay.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayBlockForm;

/**
* Block for Quickpay payment method form
*/
class Quickpay extends MagentoQuickpayBlockFormAbstractInstruction
{
/**
* Quick pay template
*
* @var string
*/
protected $_template = 'form/quickpay.phtml';
}



AbstractInstuction.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayBlockForm;

/**
* Abstract class for Quickpay payment method form
*/
abstract class AbstractInstruction extends MagentoPaymentBlockForm
{
/**
* Instructions text
*
* @var string
*/
protected $_instructions;

/**
* Get instructions text from config
*
* @return null|string
*/
public function getInstructions()
{
if ($this->_instructions === null) {
/** @var MagentoPaymentModelMethodAbstractMethod $method */
$method = $this->getMethod();
$this->_instructions = $method->getConfigData('instructions');
}
return $this->_instructions;
}
}



Model : Quickpay.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayModel;

/**
* Quickpay payment method model
*
* @method MagentoQuoteApiDataPaymentMethodExtensionInterface getExtensionAttributes()
*/
class Quickpay extends MagentoPaymentModelMethodAbstractMethod
{
const PAYMENT_METHOD_QUICKPAY_CODE = 'quickpay';

/**
* Payment method code
*
* @var string
*/
protected $_code = self::PAYMENT_METHOD_QUICKPAY_CODE;

/**
* Quickpay payment block paths
*
* @var string
*/
protected $_formBlockType = 'MagentoQuickpayBlockFormQuickpay';

/**
* Info instructions block path
*
* @var string
*/
protected $_infoBlockType = 'MagentoPaymentBlockInfoInstructions';

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

/**
* Get instructions text from config
*
* @return string
*/
public function getInstructions()
{
return trim($this->getConfigData('instructions'));
}
}



view : adminhtml/templates/form/quickpay.html




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* @var $block MagentoQuickpayBlockFormQuickpay
*/
$instructions = $block->getInstructions();
?>
<?php if ($instructions): ?>
<?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
<ul class="form-list checkout-agreements" id="payment_form_<?php /* @noEscape */ echo $methodCode ?>" style="display:none;">
<li>
<div class="<?php /* @noEscape */ echo $methodCode ?>-instructions-content checkout-agreement-item-content">
<?php /* @noEscape */ echo nl2br($block->escapeHtml($instructions)) ?>
</div>
</li>
</ul>
<?php endif; ?>



view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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="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="offline-payments" xsi:type="array">
<item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>
<item name="methods" xsi:type="array">
<item name="quickpay" 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/templates/form/quickpay.phtml




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* @var $block MagentoQuickpayBlockFormQuickpay
*/
$instructions = $block->getInstructions();
?>
<?php if ($instructions): ?>
<?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
<div class="items <?php /* @noEscape */ echo $methodCode ?> instructions agreement" id="payment_form_<?php /* @noEscape */ echo $methodCode ?>" style="display: none;">
<?php /* @noEscape */ echo nl2br($block->escapeHtml($instructions)) ?>
</div>
<?php endif; ?>



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




<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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 data-bind="attr: {'for': getCode()}" class="label"><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>
<p data-bind="html: getInstructions()"></p>
<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()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
disabled>
<span data-bind="i18n: 'Place Order'"></span>
</button>
</div>
</div>

</div>
</div>



js : Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js




/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'quickpay',
component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
}
);
/** Add view logic here if needed */
return Component.extend({});
}
);



quickpay.js : Magento/Quickpay/view/frontend/web/js/view/payment/method-renderer/quickpay.js




/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'Magento_Checkout/js/view/payment/default'
],
function (Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Quickpay/payment/quickpay'
},

/** Returns payment method instructions */
getInstructions: function() {
return window.checkoutConfig.payment.instructions[this.item.method];
}
});
}
);









share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Please update the full path of your js render file?
    – Khoa TruongDinh
    Jun 28 '16 at 13:25










  • Have you got the solution of this, If yes Please mention it here
    – mjdevloper
    Sep 9 '16 at 10:28










  • have you done this?
    – Bojjaiah
    Dec 13 '16 at 10:36










  • @magento two No
    – Naveenbos
    Dec 13 '16 at 13:16














6












6








6


3





I have tried to create new payment method in magento2, when i tried to configure it is coming in the backend, but not in the front end. If anyone fixed this issue please let me know the fixes, i am not sure the exact reason.




My block form Quickpay.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayBlockForm;

/**
* Block for Quickpay payment method form
*/
class Quickpay extends MagentoQuickpayBlockFormAbstractInstruction
{
/**
* Quick pay template
*
* @var string
*/
protected $_template = 'form/quickpay.phtml';
}



AbstractInstuction.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayBlockForm;

/**
* Abstract class for Quickpay payment method form
*/
abstract class AbstractInstruction extends MagentoPaymentBlockForm
{
/**
* Instructions text
*
* @var string
*/
protected $_instructions;

/**
* Get instructions text from config
*
* @return null|string
*/
public function getInstructions()
{
if ($this->_instructions === null) {
/** @var MagentoPaymentModelMethodAbstractMethod $method */
$method = $this->getMethod();
$this->_instructions = $method->getConfigData('instructions');
}
return $this->_instructions;
}
}



Model : Quickpay.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayModel;

/**
* Quickpay payment method model
*
* @method MagentoQuoteApiDataPaymentMethodExtensionInterface getExtensionAttributes()
*/
class Quickpay extends MagentoPaymentModelMethodAbstractMethod
{
const PAYMENT_METHOD_QUICKPAY_CODE = 'quickpay';

/**
* Payment method code
*
* @var string
*/
protected $_code = self::PAYMENT_METHOD_QUICKPAY_CODE;

/**
* Quickpay payment block paths
*
* @var string
*/
protected $_formBlockType = 'MagentoQuickpayBlockFormQuickpay';

/**
* Info instructions block path
*
* @var string
*/
protected $_infoBlockType = 'MagentoPaymentBlockInfoInstructions';

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

/**
* Get instructions text from config
*
* @return string
*/
public function getInstructions()
{
return trim($this->getConfigData('instructions'));
}
}



view : adminhtml/templates/form/quickpay.html




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* @var $block MagentoQuickpayBlockFormQuickpay
*/
$instructions = $block->getInstructions();
?>
<?php if ($instructions): ?>
<?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
<ul class="form-list checkout-agreements" id="payment_form_<?php /* @noEscape */ echo $methodCode ?>" style="display:none;">
<li>
<div class="<?php /* @noEscape */ echo $methodCode ?>-instructions-content checkout-agreement-item-content">
<?php /* @noEscape */ echo nl2br($block->escapeHtml($instructions)) ?>
</div>
</li>
</ul>
<?php endif; ?>



view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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="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="offline-payments" xsi:type="array">
<item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>
<item name="methods" xsi:type="array">
<item name="quickpay" 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/templates/form/quickpay.phtml




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* @var $block MagentoQuickpayBlockFormQuickpay
*/
$instructions = $block->getInstructions();
?>
<?php if ($instructions): ?>
<?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
<div class="items <?php /* @noEscape */ echo $methodCode ?> instructions agreement" id="payment_form_<?php /* @noEscape */ echo $methodCode ?>" style="display: none;">
<?php /* @noEscape */ echo nl2br($block->escapeHtml($instructions)) ?>
</div>
<?php endif; ?>



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




<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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 data-bind="attr: {'for': getCode()}" class="label"><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>
<p data-bind="html: getInstructions()"></p>
<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()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
disabled>
<span data-bind="i18n: 'Place Order'"></span>
</button>
</div>
</div>

</div>
</div>



js : Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js




/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'quickpay',
component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
}
);
/** Add view logic here if needed */
return Component.extend({});
}
);



quickpay.js : Magento/Quickpay/view/frontend/web/js/view/payment/method-renderer/quickpay.js




/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'Magento_Checkout/js/view/payment/default'
],
function (Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Quickpay/payment/quickpay'
},

/** Returns payment method instructions */
getInstructions: function() {
return window.checkoutConfig.payment.instructions[this.item.method];
}
});
}
);









share|improve this question















I have tried to create new payment method in magento2, when i tried to configure it is coming in the backend, but not in the front end. If anyone fixed this issue please let me know the fixes, i am not sure the exact reason.




My block form Quickpay.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayBlockForm;

/**
* Block for Quickpay payment method form
*/
class Quickpay extends MagentoQuickpayBlockFormAbstractInstruction
{
/**
* Quick pay template
*
* @var string
*/
protected $_template = 'form/quickpay.phtml';
}



AbstractInstuction.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayBlockForm;

/**
* Abstract class for Quickpay payment method form
*/
abstract class AbstractInstruction extends MagentoPaymentBlockForm
{
/**
* Instructions text
*
* @var string
*/
protected $_instructions;

/**
* Get instructions text from config
*
* @return null|string
*/
public function getInstructions()
{
if ($this->_instructions === null) {
/** @var MagentoPaymentModelMethodAbstractMethod $method */
$method = $this->getMethod();
$this->_instructions = $method->getConfigData('instructions');
}
return $this->_instructions;
}
}



Model : Quickpay.php




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoQuickpayModel;

/**
* Quickpay payment method model
*
* @method MagentoQuoteApiDataPaymentMethodExtensionInterface getExtensionAttributes()
*/
class Quickpay extends MagentoPaymentModelMethodAbstractMethod
{
const PAYMENT_METHOD_QUICKPAY_CODE = 'quickpay';

/**
* Payment method code
*
* @var string
*/
protected $_code = self::PAYMENT_METHOD_QUICKPAY_CODE;

/**
* Quickpay payment block paths
*
* @var string
*/
protected $_formBlockType = 'MagentoQuickpayBlockFormQuickpay';

/**
* Info instructions block path
*
* @var string
*/
protected $_infoBlockType = 'MagentoPaymentBlockInfoInstructions';

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

/**
* Get instructions text from config
*
* @return string
*/
public function getInstructions()
{
return trim($this->getConfigData('instructions'));
}
}



view : adminhtml/templates/form/quickpay.html




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* @var $block MagentoQuickpayBlockFormQuickpay
*/
$instructions = $block->getInstructions();
?>
<?php if ($instructions): ?>
<?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
<ul class="form-list checkout-agreements" id="payment_form_<?php /* @noEscape */ echo $methodCode ?>" style="display:none;">
<li>
<div class="<?php /* @noEscape */ echo $methodCode ?>-instructions-content checkout-agreement-item-content">
<?php /* @noEscape */ echo nl2br($block->escapeHtml($instructions)) ?>
</div>
</li>
</ul>
<?php endif; ?>



view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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="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="offline-payments" xsi:type="array">
<item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>
<item name="methods" xsi:type="array">
<item name="quickpay" 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/templates/form/quickpay.phtml




<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* @var $block MagentoQuickpayBlockFormQuickpay
*/
$instructions = $block->getInstructions();
?>
<?php if ($instructions): ?>
<?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
<div class="items <?php /* @noEscape */ echo $methodCode ?> instructions agreement" id="payment_form_<?php /* @noEscape */ echo $methodCode ?>" style="display: none;">
<?php /* @noEscape */ echo nl2br($block->escapeHtml($instructions)) ?>
</div>
<?php endif; ?>



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




<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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 data-bind="attr: {'for': getCode()}" class="label"><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>
<p data-bind="html: getInstructions()"></p>
<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()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
disabled>
<span data-bind="i18n: 'Place Order'"></span>
</button>
</div>
</div>

</div>
</div>



js : Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js




/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'quickpay',
component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
}
);
/** Add view logic here if needed */
return Component.extend({});
}
);



quickpay.js : Magento/Quickpay/view/frontend/web/js/view/payment/method-renderer/quickpay.js




/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'Magento_Checkout/js/view/payment/default'
],
function (Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Quickpay/payment/quickpay'
},

/** Returns payment method instructions */
getInstructions: function() {
return window.checkoutConfig.payment.instructions[this.item.method];
}
});
}
);






magento2 payment-methods payment payment-gateway






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 24 '18 at 3:55









Rohan Hapani

5,87721662




5,87721662










asked Jun 28 '16 at 7:41









NaveenbosNaveenbos

84311224




84311224





bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Please update the full path of your js render file?
    – Khoa TruongDinh
    Jun 28 '16 at 13:25










  • Have you got the solution of this, If yes Please mention it here
    – mjdevloper
    Sep 9 '16 at 10:28










  • have you done this?
    – Bojjaiah
    Dec 13 '16 at 10:36










  • @magento two No
    – Naveenbos
    Dec 13 '16 at 13:16


















  • Please update the full path of your js render file?
    – Khoa TruongDinh
    Jun 28 '16 at 13:25










  • Have you got the solution of this, If yes Please mention it here
    – mjdevloper
    Sep 9 '16 at 10:28










  • have you done this?
    – Bojjaiah
    Dec 13 '16 at 10:36










  • @magento two No
    – Naveenbos
    Dec 13 '16 at 13:16
















Please update the full path of your js render file?
– Khoa TruongDinh
Jun 28 '16 at 13:25




Please update the full path of your js render file?
– Khoa TruongDinh
Jun 28 '16 at 13:25












Have you got the solution of this, If yes Please mention it here
– mjdevloper
Sep 9 '16 at 10:28




Have you got the solution of this, If yes Please mention it here
– mjdevloper
Sep 9 '16 at 10:28












have you done this?
– Bojjaiah
Dec 13 '16 at 10:36




have you done this?
– Bojjaiah
Dec 13 '16 at 10:36












@magento two No
– Naveenbos
Dec 13 '16 at 13:16




@magento two No
– Naveenbos
Dec 13 '16 at 13:16










3 Answers
3






active

oldest

votes


















0














In Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js
You have defined the



rendererList.push(
{
type: 'quickpay',
component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
}
);


But your renderer file name is quickpay.js



It should be quickpay-method.js
So change the quickpay.js to quickpay-method.js






share|improve this answer





















  • I have tried this but no luck
    – Naveenbos
    Jul 12 '16 at 12:03



















0














To render custom payment method there is need to check js files..
js/view/payment/quickpay.js and
js/view/payment/method-renderer/quickpay-method.js



In etc/config.xml set active to 1

Also check these js are included or not in checkout page using firebug...if it is included then check the permission to pub/static folder.
you can also run command
php bin/magento setup:static-content:deploy



I hope this help to render the payment method...
I was also getting the same issue..but now resolved.try this!






share|improve this answer





























    0














    I was with this error too. I solved this just changing the component on view/frontend/layout/checkout_index_index.xml on this line:



    <item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>


    To



    <item name="component" xsi:type="string">Magento_Quickpay/js/view/payment/offline-payments</item>


    So I think you should change this line.






    share|improve this answer





















      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%2f123102%2fmagento-2-custom-payment-method-not-showing-in-front-end%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      In Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js
      You have defined the



      rendererList.push(
      {
      type: 'quickpay',
      component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
      }
      );


      But your renderer file name is quickpay.js



      It should be quickpay-method.js
      So change the quickpay.js to quickpay-method.js






      share|improve this answer





















      • I have tried this but no luck
        – Naveenbos
        Jul 12 '16 at 12:03
















      0














      In Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js
      You have defined the



      rendererList.push(
      {
      type: 'quickpay',
      component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
      }
      );


      But your renderer file name is quickpay.js



      It should be quickpay-method.js
      So change the quickpay.js to quickpay-method.js






      share|improve this answer





















      • I have tried this but no luck
        – Naveenbos
        Jul 12 '16 at 12:03














      0












      0








      0






      In Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js
      You have defined the



      rendererList.push(
      {
      type: 'quickpay',
      component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
      }
      );


      But your renderer file name is quickpay.js



      It should be quickpay-method.js
      So change the quickpay.js to quickpay-method.js






      share|improve this answer












      In Magento/Quickpay/view/frontend/web/js/view/payment/offline-payments.js
      You have defined the



      rendererList.push(
      {
      type: 'quickpay',
      component: 'Magento_Quickpay/js/view/payment/method-renderer/quickpay-method'
      }
      );


      But your renderer file name is quickpay.js



      It should be quickpay-method.js
      So change the quickpay.js to quickpay-method.js







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jul 4 '16 at 9:08









      AjayAjay

      619210




      619210












      • I have tried this but no luck
        – Naveenbos
        Jul 12 '16 at 12:03


















      • I have tried this but no luck
        – Naveenbos
        Jul 12 '16 at 12:03
















      I have tried this but no luck
      – Naveenbos
      Jul 12 '16 at 12:03




      I have tried this but no luck
      – Naveenbos
      Jul 12 '16 at 12:03













      0














      To render custom payment method there is need to check js files..
      js/view/payment/quickpay.js and
      js/view/payment/method-renderer/quickpay-method.js



      In etc/config.xml set active to 1

      Also check these js are included or not in checkout page using firebug...if it is included then check the permission to pub/static folder.
      you can also run command
      php bin/magento setup:static-content:deploy



      I hope this help to render the payment method...
      I was also getting the same issue..but now resolved.try this!






      share|improve this answer


























        0














        To render custom payment method there is need to check js files..
        js/view/payment/quickpay.js and
        js/view/payment/method-renderer/quickpay-method.js



        In etc/config.xml set active to 1

        Also check these js are included or not in checkout page using firebug...if it is included then check the permission to pub/static folder.
        you can also run command
        php bin/magento setup:static-content:deploy



        I hope this help to render the payment method...
        I was also getting the same issue..but now resolved.try this!






        share|improve this answer
























          0












          0








          0






          To render custom payment method there is need to check js files..
          js/view/payment/quickpay.js and
          js/view/payment/method-renderer/quickpay-method.js



          In etc/config.xml set active to 1

          Also check these js are included or not in checkout page using firebug...if it is included then check the permission to pub/static folder.
          you can also run command
          php bin/magento setup:static-content:deploy



          I hope this help to render the payment method...
          I was also getting the same issue..but now resolved.try this!






          share|improve this answer












          To render custom payment method there is need to check js files..
          js/view/payment/quickpay.js and
          js/view/payment/method-renderer/quickpay-method.js



          In etc/config.xml set active to 1

          Also check these js are included or not in checkout page using firebug...if it is included then check the permission to pub/static folder.
          you can also run command
          php bin/magento setup:static-content:deploy



          I hope this help to render the payment method...
          I was also getting the same issue..but now resolved.try this!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 23 '16 at 0:05









          Amit PandeyAmit Pandey

          13




          13























              0














              I was with this error too. I solved this just changing the component on view/frontend/layout/checkout_index_index.xml on this line:



              <item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>


              To



              <item name="component" xsi:type="string">Magento_Quickpay/js/view/payment/offline-payments</item>


              So I think you should change this line.






              share|improve this answer


























                0














                I was with this error too. I solved this just changing the component on view/frontend/layout/checkout_index_index.xml on this line:



                <item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>


                To



                <item name="component" xsi:type="string">Magento_Quickpay/js/view/payment/offline-payments</item>


                So I think you should change this line.






                share|improve this answer
























                  0












                  0








                  0






                  I was with this error too. I solved this just changing the component on view/frontend/layout/checkout_index_index.xml on this line:



                  <item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>


                  To



                  <item name="component" xsi:type="string">Magento_Quickpay/js/view/payment/offline-payments</item>


                  So I think you should change this line.






                  share|improve this answer












                  I was with this error too. I solved this just changing the component on view/frontend/layout/checkout_index_index.xml on this line:



                  <item name="component" xsi:type="string">Magento_OfflinePayments/js/view/payment/offline-payments</item>


                  To



                  <item name="component" xsi:type="string">Magento_Quickpay/js/view/payment/offline-payments</item>


                  So I think you should change this line.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 7 '16 at 21:36









                  Vanderson RamosVanderson Ramos

                  12




                  12






























                      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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2f123102%2fmagento-2-custom-payment-method-not-showing-in-front-end%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

                      1300-talet

                      1300-talet

                      Display a custom attribute below product name in the front-end Magento 1.9.3.8