How to add pay now button for making payment in the My account invoice.
Created a new extension as invoice pay now button and extend the view and template .
Added the button in the template and created the pay now button.
Stored the link in a variable and passed the link to the button.
Made the invoice ID dynamic by getting the invoice id and stored in variable and passed the variable in link
So when we click the link page will navigate to payment page
Extension:
define(
'JJ.invoice_paynow_button.Invoicepaynowbutton', ['Invoice.Details.View', 'jj_invoice_paynow_button_invoicepaynowbutton.tpl'],
function(InvoiceDetailsView, jj_invoice_paynow_button_invoicepaynowbutton_tpl, ) {
'use strict';
return {
mountToApp: function mountToApp(container) {
// using the 'Layout' component we add a new child view inside the 'Header' existing view
// (there will be a DOM element with the HTML attribute data-view="Header.Logo")
// more documentation of the Extensibility API in
// https://system.netsuite.com/help/helpcenter/en_US/APIs/SuiteCommerce/Extensibility/Frontend/index.html
/** @type {LayoutComponent} */
var layout = container.getComponent('Layout');
_.extend(InvoiceDetailsView.prototype, {
template: jj_invoice_paynow_button_invoicepaynowbutton_tpl,
getContext: _.wrap(InvoiceDetailsView.prototype.getContext, function(fn) {
var context = fn.apply(this, _.toArray(arguments).slice(1));
var internal_id = this.model.internalid
var paynow = 'https://checkout.paystand.co/v4/?publishableKey=jevmz9mey2njn2et5ewqvl9z&viewCheckout=portal-medium&module=ns_invoice&extInvoiceId=' + internal_id + '&externalCss=https:%2F%2F3425005-sb1.app.netsuite.com%2Fcore%2Fmedia%2Fmedia.nl%3Fid%3D35337581%26c%3D3425005_SB1%26h%3DaNyoyCA44ZlNLuC0s8-eqWE5xOW5Uw5qQ-6qUZdhXS3Zgv_E%26_xt%3D.css&logoUrl=https:%2F%2F3425005-sb1.app.netsuite.com%2Fcore%2Fmedia%2Fmedia.nl%3Fid%3D35337580%26c%3D3425005_SB1%26h%3D_B420yQ0SisY2CLGy4rmKE8H1bs5fIlamBIId_ViW6A7Q2Ws%0A&drawerType=open ';
context.internal_id = internal_id;
context.paynow = paynow;
return context;
})
});
}
};
});