Jump to content

Prestashop empty cart and logout after payment error


Recommended Posts

Hello,

My prestashop empties the cart and also logs out or deletes the customer data if buying as a guest when a payment error occurs or if the user cancels the payment. 

The normal behaviour should be to keep the cart and the session with the customer data to try again or with another payment method.

This happens with Credit Card, with different modules from different companies, so it may not be the module, and there is also similar behaviour with Amazon Pay.

In the end the result is an error, an empty cart, and the hassle for the buyer of having to re-enter their details.

Do you know where I can start investigating this to find out what's wrong with my prestashop installation?

Thanks

 

Link to comment
Share on other sites

  • 2 weeks later...

This issue is mainly due to SameSite directive of the PrestaShop Cookie.

When payment is done on an external page, on redirect to PrestaShop you are considered like coming from a third party so the Cookie is not read.

More info on https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite

Since PrestaShop 1.7.8.0, there a new setting on BO > Advanced Parameters > Administration > Cookie SameSite should be set to None.

Before PrestaShop 1.7.8.0, only way to fix it is to add a line into .htaccess file at root of PrestaShop files.

Header always edit Set-Cookie (.*) "$1; SameSite=None; Secure"

For this reason, many modern payment gateways avoid to redirect customer to an external page bu using javascript component like Hosted Fields or iframe for card payment directly on your own checkout page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...