#xfechx_checkout-error
1 messages ยท Page 1 of 1 (latest)
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.
- xfechx_api, 5 hours ago, 21 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1247928462229114990
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
For the request provided, it looks like you did not provide line_items in your API call. Line items tell us what prices are part of the subscription that you want to create. I am not sure why it says it is missing subscription_data.items as that isn't an actual parameter as far as I am aware, I will make sure we improve that error message. https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items
Do you have an example request ID for the first error that you sent? I can take a look at that error as well.
Not really, It is strange ae I use the same code everywhere
I attempted to create a subscription
Gotcha, unfortunately it is hard to say what that error might be with more context. As the error says, you are passing a param named name when the API isn't expecting, so the fix would be to pass that name to a different parameter, but that fix would depend on which call you are making.
Ok, so If I change API, as you can see - It works
Not sure why if I don't pass the api version (older) it does not work.
What version are you specifying when this works? Your account's default API version is a 2018 version, so this could be that parameter names have changed since then
So name is an error relative to newer api version on plans
And subscription_data[items] an error relative to subscription on newer api version
Why is this happening?
Why is my code not compatible with newer API?
What changes do I need to make
Api version 2018-01-23
๐ hopping in here since pompey has to head out soon - do you have an example of a Checkout Session creation request that works in subscription mode? Right now it looks like you're request is failing because you haven't passed in line_items OR subscription_data[items]
Yes please look at the following requests on the same connected account.
It works when I use an older API version which my code defines.
If I don't pass an API version, not sure which API version is been used and those errors come up.
This is what is sent
{
"billing_address_collection": "auto",
"tax_id_collection": {
"enabled": "true"
},
"cancel_url": "https://alkimia.yoga/subscription/test//?payment_failed=true",
"allow_promotion_codes": "true",
"success_url": "https://alkimia.yoga/stripe/payment-successful/",
"mode": "subscription",
"subscription_data": {
"default_tax_rates": {
"0": "txr_1POLnrHlZBj3A1TOkMlxVupx"
},
"metadata": {
"Notes": "Some notes",
"Affiliate": "",
"Invoice": "840",
"Checkout": "true",
"Vendor": "xfechx@gmail.com",
"Test": "true",
"Customer": " ",
"Timestamp": "20240605153106",
"Tickets": "",
"Reference": "Test",
"CustomerID": "1",
"Link": "https://alkimia.yoga/subscription/test/",
"Interval": "week"
},
"items": {
"0": {
"plan": "Subscription No. 840 [Test]-20240605153106"
}
}
}
}
I want to know why it does not work with newer API
Here is the plan data:
{
"metadata": {
"Notes": "Some notes",
"Affiliate": "",
"Invoice": "840",
"Vendor": "xfechx@gmail.com",
"Reference": "Test",
"Timestamp": "20240605153106",
"Tickets": "",
"Link": "https://alkimia.yoga/subscription/test/",
"Interval": "weekly"
},
"id": "Subscription No. 840 [Test]-20240605153106",
"currency": "EUR",
"interval": "week",
"interval_count": "1",
"amount": "20000",
"name": "Subscription No. 840 [Test]"
}
Can you share the request ID for the checkout session creation request?
Also backing up for a second- I don't see you passing in subscription_data[items] in your failing request at all. Are you 100% sure that for request req_dD1cyI2qemPfDd you're passing it in?
Same post, same subscription. Same code, same everything
Different API version
Request ID for creation request?
Success (older api passed via code)
req_AL2InioGjPbP8I (subscription)
req_b3hxR1m5Cg6xxb (plan)
Failure (no api passed via code)
req_QpOlUM9VUbaBQm (subscription)
req_X30dqGZqts91gg (plan)
Give me a minute to try a couple of things on my end
Sure
AH! Sorry I see what you're saying now - I had missed the earlier detail you had mentioned about name. It's really the Plan creation requests that are the issue, and because the Plan creation isn't working on the newer API version your Checkout Session creation request doesn't have a Plan ID to pass in to the request
So yeah, what you're seeing is expected - API version 2018-02-05 (see https://docs.stripe.com/upgrades#2018-02-05) made some pretty substantial changes to the Plans API including removing the name attribute, which is why req_X30dqGZqts91gg is failing
You need to either continue using the old API version for your plan creation request, or you need to update your code to remove name and pass in product[name] instead (https://docs.stripe.com/api/plans/create#create_plan-product-name)