#dicit53809 - django cookie consent cookie and checkout redirects
1 messages · Page 1 of 1 (latest)
I'm not sure how this works in django to be perfectly honest. Are you sure this cookie is set? What makes you expect this to work as you describe?
yes the cookie is set
You might need to reach out to the django dev community for some guidance around this, I'm not sure whether Stripe has any control over this (it's not something I've heard of)
one sec i'll share a paste
the all_third_party_cookies_exist should be returning true but it is returning false just on the stripe checkout success page
So the else statement on line 20 runs even though it shouldn't be
When I do print(cookie_consent_string) in line 10 for example I get a blank because line 9 has it as blank if the get doesn't find it
but in all other pages it finds it
Then if i accept cookies from the javascript in the cookie bar it disappears
meaning it works only if i accept the cookie bar again on the success page even though the cookies are already set in the browser
i think it has everything to do with the stripe session id and my page doesn't render fast enough or something
If i do {{requeest.COOKIES}} only in the HTML which is a popular way in django to get all cookies the one called cookie_consent does not show up even though the browser has it there...
Your success page is behaving as though the cookie was not set but you think it already was?
yes i see it in my browser inspeect that cookie_consent is there
but the success page just ignores it for some reason as if it is not there
I'm not sure why that would be, but if its a page timing issue another option would be passing that value via your success URL, if set before you redirect to checkout
Otherwise I'm not sure why this wouldnt persist as you say
yea maybe
i mean maybe you could try it. Just set a cookie in your browser and try to see if you can get the value on the success page
It might be related to cookie SameSite policy, similar to this question related to node/express: https://stackoverflow.com/a/63800957/12474862
ie, the redirect causes the cookie to be ignored, even if present
So I'd suggest checking into cookie "samesite" settings for django
There do appear to be related django settings: https://stackoverflow.com/questions/63576338/django-check-cookiess-samesite-attribute
oooh i will try that!
I am currently using COOKIE_CONSENT_SAMESITE = 'strict' for the cookie_consent cookie
So could that be why?
Yes I think that might restrict things here. I'm not an expert on this but it definitely sounds suspect
i am using defaults for the others in your stackoverflow link
because i am not setting them
i'll give it a try but that makes a lot of sense though
dicit53809 - django cookie consent cookie and checkout redirects
Nice! You're very welcome 🙂