2

$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;
    }
2

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!

1
  • thanks, Jagveer for this answer – shohel hussain Sep 12 '20 at 10:42
0

Try this code may be it will help you.

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

Thanks

2
  • Thanks for your response. Can you please tell me where should i place this code. I mean describe please. I am new to Magento – Jagveer Singh Sep 10 '20 at 14:36
  • In your code may be you will put it before return true; then it will work. – Mayur Sisodiya Sep 10 '20 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.