#Atef
1 messages · Page 1 of 1 (latest)
Can you share your code that invoked that error? I guess you're missing required parameters
the same code worked/and is still working well when i use the api keys of my old stripe account but when i switch to the new account it throws this error
Can you share the code?
That's not the code that invoked the error. You have a redirectToCheckout function in your front-end somewhere, that is what is erroring
Ah, ok
My guess is that that API call to create the Checkout Session is failing (you're not catching the error) and the id value you're returning there, and subsequently passing to redirectToCheckout, is undefined
hold on will share with you the code of the checkout redirect
I don't think the root cause of the error is there, but ok
I think I know what the issue is: the line_items[].amount parameter (and others) was removed in a recent API version: https://stripe.com/docs/upgrades#:~:text=The following parameters,create Checkout Session
I suspect that your new account is on this version (or newer), and the API call is failing because you're passing that parameter
Where as your other account is probably on an older API version where those parameters are still supported
Well, let's make sure this is the actual issue first
Can you share the ID (req_xxx) of the failing API request? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Yeah, so as I suspected. You can see the error clearly there
I'd recommend wrapping your API call in a try/catch block to actually catch these errors in your code
So, acct_1MFKseJepgMTkzPP must be a pretty new account as its on the latest API version: 2022-11-15
yes, i see that. "You cannot use line_items.amount"
yes, just created it a week ago.
how do i do that?
i think it's already wrapped in try/catch
or you mean the redirect to checkout function in the front end?
are you still here?
If you have 2 accounts on different API versions, you have 2 options:
- Upgrade your integration to not use these parameters (recommended).
- Downgrade this account to use the same API version as your other account, and you won't need to change your integration.
Great! You should use this guide which highlights how to create a Checkout Session without those unsupported parameters: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout#redirect-customers
let us know if you have any specific Qs
Will do. thanks so much