1

I want to be able to redirect to a custom page after the order is place so I can build a post request to a 3rd party payment gateway and send the customer to the payment gateway, similar to paypal flow.

1
  • Since Im pretty new to magento there is not much I've done in that area. I been able to integrate payments that will live inside magento. But not this one that lives outside. The approach I'm taking is place order just like magento does, then instead redirect the user to a custom page/controller so I can build the post request as the payment gateway needs it, then receive the post from the gateway and finish the process. I know the process of redirection needs to be in the frontend (js) but I havent found the right documentation to learn how and I'm not that good in javascript. Nov 23 '16 at 21:25
1

At first, your custom payment UI component should extend Checkout default payment or it child - cc form component.

In your custom payment UI component, you can specify afterPlaceOrder method and set redirectAfterPlaceOrder to false to disable default behavior.

All logic, related to place order, is specified in placeOrder method:

placeOrder: function (data, event) {
    var self = this;

    if (event) {
        event.preventDefault();
    }

    if (this.validate() && additionalValidators.validate()) {
        this.isPlaceOrderActionAllowed(false);

        this.getPlaceOrderDeferredObject()
            .fail(
                function () {
                    self.isPlaceOrderActionAllowed(true);
                }
            ).done(
                function () {
                    self.afterPlaceOrder();

                    if (self.redirectAfterPlaceOrder) {
                        redirectOnSuccessAction.execute();
                    }
                }
            );

        return true;
    }

    return false;
}
1
  • @AdroRocker if the answer is helpful for you, please, accept it.
    – joni jones
    Dec 3 '16 at 9:56

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.