We have developed a payment plugin for Magento 2. The plugin is working correctly in our test environments and in some merchant environments but it's failing in some merchants stores due to not being able to recover the session data.

The merchant is using Magento Commerce 2.3.2 and it's using Fastly as a cache solution.

Basically, the plugin stores some data in the session before redirecting the user to the payment gateway. When the user is redirected back (the redirection is made using a location.href), an action of a plugin controller is triggered, but when executing that action, the content of the session variables is empty.

We suspect that the issue might be related to the cache configuration. But unfortunately, we can't properly debug the issue because we don't have access to the merchant environment and also Magento Commerce and Fastly are paid products.

Has anyone come across an issue like this before and can provide some solution?

  • Hi Esteban, are you find any solution for this. For me also facing the same issue Commented Oct 8, 2020 at 13:47
  • Hello. Unfortunately, I couldn't. I had to rewrite the plugin to minimize the usage of the session and modify some steps in the payment processing. I took a look about what other payment plugins were doing and try to replicate that. But even with that changes, we still get an error every now and then related to the session. Commented Oct 9, 2020 at 13:18

2 Answers 2


Check your merchant stores' session cookie configuration and ensure that they are not using same-site "strict". If you are relying on session cookies when redirecting, you will need to set them to "lax". This may not be it, but it's definitely something to rule out.


the issue relate to the SameSite cookie.

You can refer this commit, Paypal module https://github.com/magento/magento2/commit/231ba74c725a4e7d4171b2735f7eb2808a5f4c98

magento support docs: https://support.magento.com/hc/en-us/articles/360049032952-Customers-get-logged-out-or-lose-cart-content-on-Magento-storefront

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.