#niels_api
1 messages ยท Page 1 of 1 (latest)
๐ 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.
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;
};
Hi, can you share the event id from that checkout for me? The id that starts with evt_
One second
Sure!
evt_10ytPGF0DjJjNRCTwwoKs8BZ
Thank you, taking a look
Thanks a lot!
Just did it, same error ๐ฆ
If you hard code the checkout session on the request are you still setting the error?
Testing this on my end as well
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",
Is this only happening for this Checkout Session?
Do other Session retrievals work for you?
Yes looks like other ones work
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
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
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
Including the "?" right?
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 ๐
Glad to hear that it's working now!