#k3davis-checkout-session

1 messages · Page 1 of 1 (latest)

fringe belfry
#

Can you elaborate on what you mean by "literal"? What are you seeing?

sinful rampart
fringe belfry
#

What is the code you're using to set the success_url?

sinful rampart
#

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}");

fringe belfry
#

When you console.log(opts.SuccessUrl) and console.log(session_id) what do you get?

sinful rampart
#

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

fringe belfry
#

What is session_id before being added to the success url?

sinful rampart
#

there is no query string at all before that

fringe belfry
#

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

sinful rampart
#

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

fringe belfry
#

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