#niels_api

1 messages ยท Page 1 of 1 (latest)

static pierBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1222650226674765875

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

devout whaleBOT
unreal escarp
#

Error:

#

Proof that it actually exists

#

Code:

export const getStripeSessionDollarValue = async (sessionId: string) => {
  const session = await stripe.checkout.sessions.retrieve(sessionId);
  if (!session.amount_total) return null;

  return session.amount_total / 100;
};
oblique garden
#

Hi, can you share the event id from that checkout for me? The id that starts with evt_

unreal escarp
#

One second

oblique garden
#

Sure!

unreal escarp
#

evt_10ytPGF0DjJjNRCTwwoKs8BZ

oblique garden
#

Thank you, taking a look

unreal escarp
#

Thanks a lot!

oblique garden
#

Can you attempt to make that call again?

#

To retrieve the checkout session?

unreal escarp
#

Just did it, same error ๐Ÿ˜ฆ

oblique garden
#

If you hard code the checkout session on the request are you still setting the error?

#

Testing this on my end as well

unreal escarp
#

Yeah, same error with this code:

export const getStripeSessionDollarValue = async (sessionId: string) => {
  const session = await stripe.checkout.sessions.retrieve(
    'cs_live_b1aomb2jrjzdkf7coxvayetgjakazigmlbrjkdcpf72bwgmrxkqfjyj6pe',
  );
  if (!session.amount_total) return null;

  return session.amount_total / 100;
};
#

Using: "stripe": "14.22.0",

oblique garden
#

Is this only happening for this Checkout Session?

#

Do other Session retrievals work for you?

unreal escarp
#

Yes looks like other ones work

oblique garden
#

It looks like you were mainly trying to get the total amount which it looks like you've already attained that information. Further looking into why this request is failing

unreal escarp
#

Yeah we need this server side code to be very reliable since we track the conversions with it. Just rolled it out today in production and were already getting this error so i thought i'd check in what i was doing wrong. Thanks for helping out

oblique garden
#

It looks like you're manipulating the string on your request. Can you copy and paste the id with this, cs_live_b1aomb2JRJZdKf7COXvAYETGjAkazIgmlbrjKDCpf72BwgmRXKqfjyj6pe?

#

On your request, it looks like you're lowering the cases: cs_live_b1aomb2jrjzdkf7coxvayetgjakazigmlbrjkdcpf72bwgmrxkqfjyj6pe

unreal escarp
#

Including the "?" right?

oblique garden
#

No

#

Just the ID please

unreal escarp
#

Ok, my bad

#

This seems to work!

#

I am very surprised about this actually

#

But i guess it works now so it is solved, thanks a lot ๐Ÿ™‚

oblique garden
#

Glad to hear that it's working now!