#k3davis-checkout-session
1 messages · Page 1 of 1 (latest)
i'm seeing something like "https://my.success/page?session_id={CHECKOUT_SESSION_ID} as the final success url, without the session id added to the url in place of that "token" in the string
What is the code you're using to set the success_url?
you can see the end result here if that helps evt_1LG4NSHIU60wpvgmgyjcFVrK but i can copy the code if you want, it's c#
where opts is the SessionCreateOptions
opts.SuccessUrl = QueryHelpers.AddQueryString(opts.SuccessUrl, "session_id", "{CHECKOUT_SESSION_ID}");
When you console.log(opts.SuccessUrl) and console.log(session_id) what do you get?
from what context? client side code on the custom success page itself?
the value of session_id (once parsed from the url) is %7BCHECKOUT_SESSION_ID%7D
What is session_id before being added to the success url?
there is no query string at all before that
So I'm not sure what to advise here, as the AddQueryString() method is obviously not returning just a string. I believe it is trying to escape the curly braces. I would recommend generating the query string without {CHECKOUT_SESSION_ID} at the end of it, then using a string concatenation method like concat() to append {CHECKOUT_SESSION_ID} as a string
essentially build the successurl by appending the query string manually instead of using the util to do so?
i mean, you can see from the event the end result, it looks right except the curly braces are encoded. even discord is doing that... seems like normal url behavior
but i will see if that method makes any difference
The problem is that the method is trying to (as you said) encode the string to escape the curly braces {} in {CHECKOUT_SESSION_ID}, but (since you need to pass a string into the API request body) you should build the URL without using AddQueryString and instead use a normal string builder