#antonio_subscription-typescript
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/1461427624260927581
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi! looking into this now
any chance you can grab one of the request IDs from your retrieve requests for me and share it here?
Yeah, give me one minutes because I am not familiari with that.
you're probably running into this breaking change which removes these fields from the subscription level and moves them to the subscription items
I'm doing the retrieve request with Stripe CLI. How can i get the request ID?
Here's the request ID: req_fMg3I2NzMWvytI
i think we're OK without a request ID for now if you can't find it, although you should be able to find it using these instructions or by looking at the logs in workbench
here are where those properties live now:
https://docs.stripe.com/api/subscriptions/object?api-version=2025-12-15.clover#subscription_object-items-data-current_period_end
https://docs.stripe.com/api/subscriptions/object?api-version=2025-12-15.clover#subscription_object-items-data-current_period_start
can you try looking there instead?
I see the API Version: 2025-01-27.acacia
I think that's a different version than one actual.
yeah it does look like those fields are present on the response. so is the issue just that typescript is complaining that the fields aren't available anymore?
if you ignore typescript and retrieve the object are you seeing the fields?
Yeah, because i've updated the Stripe to latest version.
I haven't tried it because i tried to resolve the problem.
Right now, i'll try that.
When you upgrade stripe-node to the latest version you get the types matching the latest API version specifically where the period has moved per items
So if you use an older API version in your code you have to suppress the type errors in Typescript since your API shape is different from the latest
antonio_subscription-typescript
I've just retrieved the subscription and the structure is different compared to Stripe CLI. I notice that's got a SubscriptionItems with field called items.
The issues is that i can't suppress the type errors because i receive the actual structure with items fields.
Sorry I don't really get your wording right now. items has been present on the Subscription resource since 2017 or so, it's not new
what's new is that the current_period_start and current_period_end used to be top-level and have moved inside items
In addition to the discount field because it's been moved into discounts. Right?
In any case, the main issues is the the inconsistency between Stripe CLI and the API used by node.js. Because through Stripe CLI, I still see the fields mentioned. Whereas through the API, I see the updated fields.
The Stripe CLI uses your account's default API version. So really you need to be aware of which exact API version you use each time since that completely changes the API shape. Or always use the latest in all places
Got it. So, how can i change API version of my account?
In the Dashboard in Workbench, but changing the API version globally can be extremely dangerous if you have code in production that doesn't expect the API version change. It's something to be really really careful about
For example if you use webhooks you want to read https://docs.stripe.com/webhooks/versioning
but at least starting by testing
- the latest API version in the latest Stripe node
- using https://docs.stripe.com/cli/post#post-stripe-version to force the same version in the CLI
Got it.
I've just noticed, on Workbench, that i'm using the API versions: 2025-12-15.clover. So, it seems strange to me that the retrieval of subscription doesn't reflect the actual structure. O am i wrong with the reasoning?
I see as follows in test mode.
Workbench is different from the CI and uses a different API version too
Really what's crucial is understand API versions as a concept and then explicitly using the same one when testing across tools
So, if I understand correctly, i need to be aware of the API version used in node.js and its structures. Even though Workbench uses different versions for its own needs. Is that
yes
So if i use an earlier version API, i can be sure that those field'll be present. As like current_period_start, current_period_end, discount in Subscription.
yes, but the types will be incorrect unless you also use an older version of stripe-node
sure thing!
May i ask another question, about the API version webhook?
sure
Now that I understand the API versions, I checked the API version used by the webhook. It is set to the latest version, which is 2025-12-15.clover.
I should mention that I was testing with a previous account. On that account, the API version on webhooks is set to 2024-04-10.
I can imagine that in the new account it is not possible to set it to that specific version.
it gives me only these options.
You can't update the API version of an existing WebhookEndpoint (unless you change the default API version for the whole account). But you can create a new one with the right API version pinned (either in the DAshboard or the API)
I recommend reading https://docs.stripe.com/webhooks/versioning which explains how to migrate a webhook endpoint/code already in production safely
Yeah, but i can't use the specific version like as 2024-04-10 because when i create a new Webhook Endpoint, the configuration gives me only two options, as shows in the image above
Correct the Dashboard only lets you use the current default API version of the account or the latest. You can use https://docs.stripe.com/api/webhook_endpoints/create though in code and pass https://docs.stripe.com/api/webhook_endpoints/create#create_webhook_endpoint-api_version to what you want
Okay, got it. I'll proceed to make the webhook creation through code.
Thanks very much!