#saintlike_code
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/1400105325889065081
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- saintlike_code, 21 hours ago, 36 messages
Hi, I will attach a more descriptive code snippet in a second, the 400 something characters wasnt nearly enough :\
Hello
1/ Do you have an example for the 429 error? What URL is it hitting?
2/ There's no way to set the customer name via the Checkout Session directly afaik
3/ Have you considered putting them in the metadata upon checkout creation?
For the 429 error you can see what's happening here https://www.showmeyoursaas.com/checkout/studio
I was told in the previous chat that the url in the console (with the 429 error) has to do with stripe internal sdk, but I noticed my application makes three post requests to route where session creation happens
const createCheckoutSession = async (userInfo = {}) => {
return fetch(`${base}/api/checkout-session`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
priceId: 'price_1RoFMnQlxuTOhr2iQbwp8Wys',
})
})
.then((res) => {
if (!res.ok) {
throw new Error('Failed to create checkout session')
}
return res.json()
})
.then((data) => {
if (!data.clientSecret) {
throw new Error('No client secret returned')
}
setIsLoading(false)
return data.clientSecret
})
.catch((err) => {
console.error('Error fetching client secret:', err)
setError(err.message)
setIsLoading(false)
return null
})
}
const promise = useMemo(async () => {
return await createCheckoutSession()
}, [])```
This is what @/app/checkout/studio/page.jsx looks like, specifically the part for creating a session
export async function POST(request) {
try {
const body = await request.json();
const { priceId } = body;
const selectedPriceId = priceId;
const sessionData = {
ui_mode: "custom",
line_items: [
{
price: selectedPriceId,
quantity: 1
}
],
mode: "payment",
customer_creation: "if_required",
return_url: `${base}/checkout/complete?session_id={CHECKOUT_SESSION_ID}`
};
const session = await stripe.checkout.sessions.create(sessionData);
return NextResponse.json({ clientSecret: session.client_secret })
} catch (error) {
console.error("Checkout session error:", error)
return NextResponse.json({ error: "Failed to create checkout session" }, { status: 500 })
}
}```
this is @/api/checkout-session/route.jsx where session is created
Yeah I don't think that rate limit should affect the payment process really.
I think the memoization is not working as intended and it makes extra API requests when your component re-renders
Also, I'm only seeing one call to your API when I test on my browser
do you get these errors in the console too?
So I suspect this has something to do with component re-rendering
Only seeing it once per page load
Do you know if stripe has an example checkout implementation with next js 15 someplace in the docs? The only ones i could find are from regular react and node.js
I also tried putting all the async operations like creating a session up the tree in a layout.jsx component but then checkoutprovider would never render any element that was inside of it, not even console.logs nested inside of it worked
Ah we have a quickstart but not for Elements + Checkout Session API - https://docs.stripe.com/payments/quickstart?client=next
also for that 429, have you tried disabling Assistant tool tip to see if that makes any difference?
https://docs.stripe.com/js/initializing#init_stripe_js-options-developerTools-assistant
I see from your old thread that you only saw these errors when the tool tip was added to the page
'server-only'
import Stripe from 'stripe'
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: "2025-06-30.basil",
developerTools: {
assistant: { enabled: false }
}
})``` is this how you disable it? im not sure if im getting these docs right, when i add this new parameter the checkout session fails to initialize
yup, that looks about right
this is what i get in the console when i add developerTools object
Oh wait
you don't put it server-side
that parameter is for client-side Stripe.js
So it goes where you configure your publishable key
So it'd be part of loadStripe function instead
Yeah i dont think the assistant was the cause
Gotcha. Thanks for confirming..
I don't think it should really cause issues with the Payment stuff though
yeah i should probably rewrite the checkout page from scratch so console isnt full of errors from the quickstart you sent, thanks for all the help though ๐