Magento – Redirect to external url after order creation

magento2payment-gatewayredirect-url

I am making a payment gateway and I need to redirect from the invoice page to an external url.
Basically when an order is created at Magento I create an order in a 3rd party app with curl, then I get unique ID from that order which is used to redirect to an external invoice page.

The question is how do i make that external redirect? Most logical solution seems to override the checkout controller and in that controller I would call my model, model returns that unique ID and I make redirect to the invoice page.

Problem is I can't understand how to override the checkout controller.

Best Answer

I think there is no explicitly defined extension point for your scenario. However, you can override the default behavior by creating a plugin on \Magento\Checkout\Controller\Onepage\Success::execute method.