#ben-checkout-error

1 messages · Page 1 of 1 (latest)

tranquil copperBOT
vocal badger
quiet yoke
#

Hi 👋

That URL looks to be pointing to a server running locally

vocal badger
#

What does that mean? Does that mean I have to use another URL to call the API?

quiet yoke
#

You are sending me photos, which is really hard to parse. What API are you trying to hit?

vocal badger
#

I think I'm trying to hit {{baseUrl}}/v1/checkout/sessions/:session

quiet yoke
#

Okay but that {{baseUrl}} is going to be pretty important

#

If it's https://api.stripe.com I can help, otherwise I can't

vocal badger
#

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.

quiet yoke
#

Ah, so you are asking about how to retrieve the session ID from the return URL?

vocal badger
#

I got the session_id in the payment success page already

quiet yoke
#

Okay, so where are you trying to access the ID from?

vocal badger
#

and I want to use that session_id directly and put it into the local server to call "retrieve session" API

quiet yoke
#

Well that would be up to your app to store and re-use then.

vocal badger
#

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

quiet yoke
#

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

vocal badger
#

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)

quiet yoke
#

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.