#dicit53809 - django cookie consent cookie and checkout redirects

1 messages · Page 1 of 1 (latest)

north spadeBOT
ionic snow
#

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?

zealous kiln
#

yes the cookie is set

ionic snow
#

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)

zealous kiln
#

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...

ionic snow
#

Your success page is behaving as though the cookie was not set but you think it already was?

zealous kiln
#

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

ionic snow
#

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

zealous kiln
#

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

ionic snow
#

ie, the redirect causes the cookie to be ignored, even if present

#

So I'd suggest checking into cookie "samesite" settings for django

zealous kiln
#

oooh i will try that!

#

I am currently using COOKIE_CONSENT_SAMESITE = 'strict' for the cookie_consent cookie

#

So could that be why?

ionic snow
#

Yes I think that might restrict things here. I'm not an expert on this but it definitely sounds suspect

zealous kiln
#

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

ionic snow
#

dicit53809 - django cookie consent cookie and checkout redirects

zealous kiln
#

that did the trick. Thank you!

#

i would not have figured that out thanks

ionic snow
#

Nice! You're very welcome 🙂