#antonio_subscription-typescript

1 messages ¡ Page 1 of 1 (latest)

dense sealBOT
#

👋 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.

paper jay
#

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?

night quarry
#

Yeah, give me one minutes because I am not familiari with that.

paper jay
#

you're probably running into this breaking change which removes these fields from the subscription level and moves them to the subscription items

night quarry
#

Here's the request ID: req_fMg3I2NzMWvytI

paper jay
#

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?

night quarry
#

I see the API Version: 2025-01-27.acacia

I think that's a different version than one actual.

paper jay
#

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?

night quarry
#

Yeah, because i've updated the Stripe to latest version.

night quarry
#

Right now, i'll try that.

dense sealBOT
tired jackal
#

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

night quarry
#

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.

night quarry
tired jackal
#

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

night quarry
#

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.

tired jackal
#

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

night quarry
#

Got it. So, how can i change API version of my account?

tired jackal
#

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

night quarry
#

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.

tired jackal
#

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

night quarry
#

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

tired jackal
#

yes

night quarry
#

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.

tired jackal
#

yes, but the types will be incorrect unless you also use an older version of stripe-node

night quarry
#

Yeah, I think I got it correctly.

#

Thank you very much

tired jackal
#

sure thing!

night quarry
#

May i ask another question, about the API version webhook?

tired jackal
#

sure

night quarry
#

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.

tired jackal
#

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

night quarry
dense sealBOT
tired jackal
night quarry
#

Okay, got it. I'll proceed to make the webhook creation through code.

Thanks very much!