I have worked custom payment and I've received the response from the payment I need to load the success page from my custom controller how can i do it. Whether I need to create own page or can I use core function to load success page in my custom controller is that possible please help me

public function execute()

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $order = $objectManager->create('\Magento\Sales\Model\Order') ->loadByIncrementId($orderId);
    $orderState = Order::STATE_PROCESSING;

1 Answer 1


Add following code to your contoller after checking you've recieved response.

$resultRedirect = $this->resultRedirectFactory->create();
    return $resultRedirect;

Note that you can directly use resultRedirectFactory, you don't need to inject it.

  • This one redirect to shopping cart page because there is no quote id do you any idea to load quote? Commented Nov 16, 2017 at 8:55
  • As the order has been completed on users end and the items in cart are destroyed , i don't think you would be able to access it directly, but you can store quote id beforehand in session so you can directly load the quote object if you require it. Commented Nov 16, 2017 at 9:05
  • Also please accept the answer if it solved your original question Commented Nov 16, 2017 at 9:06
  • Hi @JeevaChezhiyan did you solved the issue? Could you please share how did you do that?
    – Nayem323
    Commented Sep 25, 2021 at 20:39

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.