#ben-checkout-error
1 messages · Page 1 of 1 (latest)
Hi 👋
That URL looks to be pointing to a server running locally
You are sending me photos, which is really hard to parse. What API are you trying to hit?
Can you share a request ID? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
I think I'm trying to hit {{baseUrl}}/v1/checkout/sessions/:session
Okay but that {{baseUrl}} is going to be pretty important
If it's https://api.stripe.com I can help, otherwise I can't
This is how you would retrieve a checkout session from the Stripe API https://stripe.com/docs/api/checkout/sessions/retrieve
I hope to use the session_id of every payment success page. I have to pass the session_id when calling the API to retrieve, right? But, after passing it, the req can find the session_id that has been passed.
This is what i found to do so:
const session = await stripe.checkout.sessions.retrieve(req.query.session_id);
But, when I use "req.query.session_id", it is empty.
Ah, so you are asking about how to retrieve the session ID from the return URL?
I got the session_id in the payment success page already
Okay, so where are you trying to access the ID from?
and I want to use that session_id directly and put it into the local server to call "retrieve session" API
Well that would be up to your app to store and re-use then.
I can access the ID on the frontend
but don't know how to put it in when calling the API
Like as a parameter value or sth?
I tried it, but what i got was empty when trying to access any data from req
Okay that is your app not retaining the session ID. I would try triggering a POST request back to your server when the customer hits the success page that sends the session ID in the body. Then on your server you can retrieve it and store it if you need to
What kind of Post request should I trigger?
So, creating another API in my local server so that I can post the session_id, which can be accessed in my local server? (kinda strange, not sure what you mean)
It's unclear to me what exactly you are trying to do so I'm trying to provide some ideas. However, this is still more to do with your app than Stripe APIs as far as I can tell.