I have been able to develop a module that redirects customers to payment gateway(external url) after the PlaceOrder button is clicked. After transaction is completed on the payment gateway, I redirect to a controller on Magento and this allows me to get the transaction status and safe to a custom table. After saving, I redirect to checkout_onepage_success.xml and included my template="Vendor_Module::checkout/success.phtml" but I keep getting an error -
1 exception(s): Exception #0 (Magento\Framework\Exception\InputException): Id required
If you are overriding Onepage success controller and implementing your custom logic, in this case you will not get LastOrderId in 'checkout_onepage_controller_success_action' event which is dispatched in the success action controller.
Thats why it is throwing 'Id required' input exceptions.
Avoid Overridding Onepage controller action
Instead of integrating your specific peice of code in success controller, try to use observer checkout_onepage_controller_success_action which is being dispatched in success action controller and implement your logic in observer.
Hope, It will solve your problem, as I was getting the same error and it is solved for me with this approach
Screen shot for the error