Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sameSiteCookieValue == 'Strict' config value with some Commerce gateways #2737

Open
rob-c-baker opened this issue Mar 16, 2022 · 0 comments
Open

Comments

@rob-c-baker
Copy link

Description

If a site has the sameSiteCookieValue Craft config value set to Strict (as opposed to Lax or null) this can create a problem with any payment gateway that has the user fill in details on another domain via redirect before being redirected back to the Craft site for order completion.

The issue manifests as what appears to be a forgotten session after redirect back from authentication. Due to the fact that session cookies set to SameSite: Strict are not sent by the browser when the referrer hostname does not match the hostname where the cookie was originally set.

The effect is that when the user is redirected back, Craft / Commerce thinks there is no session, starts a new one and in the process, whatever is in the cart disappears for the user. In our case, we have a condition on our checkout that redirects users away from the checkout when their cart is empty so the visible effect for our users was completing a payment stage and ending up on another page of our site with an error stating they cannot checkout as their cart is empty.

I have found that this is generally not a visible problem for us if the off-site payment details / authentication is successful as the session is not needed in order to show the checkout confirmation page.

This all goes away if the session cookie has SameSite: Lax. It would be great if this is made clearer in the docs, or is somehow worked around in code.

Additional info

  • Craft CMS version: 3.7.23
  • Craft Commerce version: 3.48
  • PHP version: 7.4.3
@rob-c-baker rob-c-baker changed the title sameSiteCookieValue == 'Strict' config value with Some Commerce Gateways sameSiteCookieValue == 'Strict' config value with some Commerce gateways Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants