1

I had a custom payment module that was working properly on 2.2.x as well as 2.3.x. However, when I tried to install it onto a clean 2.4.2 instance, I found that the function getLastSuccessQuoteId() called on the checkout session always gave me a null result.

The payment gateway I implemented is more or less like the PayPal Hosted Solution, where the customers would be redirected to a 3rd party platform for the settlement, and redirected back to the shop afterward via a return URL.

On 2.2.x and 2.3.x, I was able to get the previous success quote ID by calling getLastSuccessQuoteId() in this return URL, but now it gave me nothing.

I am not sure which part of the new Magento was contributing to the difference here. I have tried the following directions:

  • add the CSP whitelist
  • switch on the CSP report-only mode in the config.xml
  • disable the CSP module
  • implement those new CsrfAwareActionInterface, HttpPostActionInterface, HttpGetActionInterface for the return action controller

In the end, I have even tried to rewrite the module completely based on the PayPal Hosted solution, but I am still getting the same result.

I really have no clue what I could have missed out on.

5
  • have you found the solution yet ? I am facing the same issue on Magento 2.4.2
    – Dhimant
    Jul 22 at 1:37
  • @Dhimant you may want to check if that is caused by the SameSite cookie policy
    – d.yuk
    Jul 22 at 2:19
  • The module I am using has a little different architecture, before redirecting customer to payment gateway it loads a block, and based on the values stored in order it redirects customers to the the payment gateway, also SAMESITE cookie was set to LAX, now it's blank, I tried to apply none, but for some reason it is still blank, also I am able to fetch the values sometimes and process payments but sometimes , it is blank.
    – Dhimant
    Jul 22 at 4:59
  • @d.yuk did you manage to find a solution? I am facing the same problem with getLastSuccessQuoteId() return null and I can't load the order to complete the redirect in my controller Aug 9 at 8:53
  • @MiroslavPetroff My problem was caused by the SameSite cookie policy issue. So you might want to check if you are having the same problem there
    – d.yuk
    Aug 9 at 10:42

Your Answer

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

Browse other questions tagged or ask your own question.