When using a custom payment module, I am trying to execute code with my payment processor then submit the order to the system to run the php methods. To do that I need to be able to execute the placeOrder() function, in a custom function or override it, from within the method-renderer file.

The button:

        attr: {title: $t('Place Order')},
        enable: (getCode() == isChecked()),
        click: processPayment,
        css: {disabled: !isPlaceOrderActionAllowed()}
    class="action primary checkout"
    <span data-bind="i18n: 'Place Order'"></span>

And the function:

    function ($, Component) {
        'use strict';
        return Component.extend({
            //Other function omitted for space
            processPayment() {
                //Some form of placeOrder() function execution

1 Answer 1


You can use placeOrder() function.

Just put your logic in your Model's capture method as per your need

public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
        if (!$this->canCapture()) {
            throw new \Magento\Framework\Exception\LocalizedException(__('The capture action is not available.'));
        return $this;

reference https://www.mageplaza.com/devdocs/magento-2-create-payment-method/

  • It didn't work like that before, but now it does. Thank you for your assistance.
    – MCattaneo
    Oct 29, 2021 at 6:55
  • happy to hear. it works for you :) have a nice day ahead Oct 29, 2021 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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