-1

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

Peter
  • 4,493
  • 6
  • 41
  • 64

1 Answers1

0

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

<preference for="Magento\Checkout\Controller\Onepage\Success" type="Arman\Checkout\Controller\Onepage\Success" />

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.

public function execute(\Magento\Framework\Event\Observer $observer)
    {
        try {        
             $orderIds = $observer->getEvent()->getOrderIds();
                 //enter code here
        } catch (Exception $e) {

        }
    }

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

Khan arman
  • 11
  • 2