Question

$this->checkoutSession->getLastSuccessQuoteId()
$this->checkoutSession->getLastQuoteId()
$this->checkoutSession->getLastOrderId()

These things always returns false after payment success, so i always redirect to cart page. I search over the google and every where but not found helpful. My model file is:

vendor/magento/module-checkout/Model/Session/SuccessValidator.php

public function isValid()
    {
        if (!$this->checkoutSession->getLastSuccessQuoteId()) {
            return false;
        }

        if (!$this->checkoutSession->getLastQuoteId() || !$this->checkoutSession->getLastOrderId()) {
            return false;
        }
        return true;
    }
Was it helpful?

Solution

After my research i have made solution for this. I made changes in Payment gateway Controller/Response.php.

I have added the following code just after "Success" response.

$this->_checkoutSession->setLastOrderId($order->getId());
$this->_checkoutSession->setLastQuoteId($order->getQuoteId());
$this->_checkoutSession->setLastSuccessQuoteId($order->getQuoteId());

Issue Solved!

OTHER TIPS

Try this code may be it will help you.

$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('checkout/onepage/successs');
return $resultRedirect;

Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top