0

I've integrated some custom payment module. I am getting trouble with form submission with JS after payment response. I need to submit the checkout form on click of place order but with JS and that only after processing the payment.

How can I place an order with JS?

0

I'm not sure about your case. But, there is a call back function after placing order.

vendor/magento/module-checkout/view/frontend/web/js/view/payment/default.js

    /**
     * After place order callback
     */
    afterPlaceOrder: function () {
        // Override this function and put after place order logic here
    },

Put this function in your custom payment method renderer component.


Update with the comment:

Can i first trigger my function inJS AND then after processing the payment trigger the placeorder. How is this possible?

You can write your own placeOrder in your payment method renderer component.

  • Thanks for this. Can i first trigger my function in` JS ` AND then after processing the payment trigger the placeorder. How is this possible? – Garry Nov 12 at 5:19
  • You can write your own placeOrder in your payment method renderer component. – Khoa TruongDinh Nov 12 at 6:20
  • iostpay-method.js in method-renderer define( [ 'Magento_Checkout/js/view/payment/default' ], function (Component) { 'use strict'; return Component.extend({ defaults: { template: 'Iostpay_Iostpaymagento/payment/iostpay' }, getMailingAddress: function () { return window.checkoutConfig.payment.checkmo.mailingAddress; }, getInstructions: function () { return window.checkoutConfig.payment.checkmo.mailingAddress; }, });}); – Garry Nov 12 at 6:32
  • 1
    Add placeOrder function inside Iostpay_Iostpaymagento/js/view/payment/method-renderer/iostpay-method. – Khoa TruongDinh Nov 12 at 7:49
  • 1
    Thanks, this really helped to trigger my method. now, how can I successfully place-order, after the successful payment. – Garry Nov 12 at 8:22

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.