#tom-webhook-apiversion
1 messages ยท Page 1 of 1 (latest)
Hi ๐ the default version is used to if an API request or webhook endpiont is not configured to use a specific version. Passing the API version when making the request forces them to use a specific version, and webhook endpoints can be created so they are pinned to specific versions as well via the API:
https://stripe.com/docs/api/webhook_endpoints/create#create_webhook_endpoint-api_version
Thanks toby - so this means that even though I'm consuming the webhook using a fixed stripe version, I'm actually getting the dashboard stripe version, which is older?
Sorry, I'm not grasping what that means. Can you elaborate on what you mean by "consuming the webhook"? Are these hypothetical questions, or do they reovlve around behavior you're seeing in testmode while testing these flows? Do you have specific examples from your testing that you can share that I can take a closer look at?
Ok sorry - I mean that when I get a webhook request from your services, I use the stripe object (constructed with an api version), to do the constructEvent() from the payload. I had assumed that as the apiVersion in code is a later version, the webhook payload would be that code version? (e.g. the dashboard version is 1, but the code version is 2, I assume that the webhooks returned would be version 2)
Ah gotcha, no, that's not a good assumption to make. The Events will be received based on the API version of the webhook endpoint. If a version is not provided when the webhook endpoint is created in Stripe, it will be linked to the default API version for the Stripe Account. If a specific API version is provided while creating the webhook endpoint, that endpoint will be "pinned" to that specific API version and always receive Events in that version.
ok thanks - is there any problem with these being out of sync, do you see? Just wondering if I should escalate the update for webhooks
It depends
Largely on whether you're using one of our libraries that is pinned to specific API versions, with those you can run into version mismatch issues when working with Events.
tom-webhook-apiversion
by pinned to a specific version - you mean at the constructor we pass through the apiVersion, right?
๐ taking over (I renamed the thread)
and so the difference would be that the event is coming back in version 1 schema, but we expect it to be version 2 schema and so there can be attributes missing etc?
You know - it's a real shame you can't upgrade the version in test, but keep prod at the old version to test that everything works :/
@regal river your Stripe account has a default API version. That's used when you pass no API version at all in your code, and you use an SDK that doesn't force one by default. It's also use to generate Events sent to your WebhookEndpoint if you haven't forced an API version.
So with what you explained above, you seem to force the API version on in the calls made by the SDK. You also seem to have forced an API version when creating the WebhookEndpoint in the API (what toby explained). If you did all that you're fine
And yes agreed, we'd like to support split API versions in the future, just not something we've been able to tackle
actually it looks like we aren't using the stripe: createWebhook endpoint at all - we are just using the createEvent function in the stripe library to parse/verify the webhook
Okay so that means someone went and created the WebhookEndpoint manually in the Dashboard, in which case it'll use the default API version on your Stripe account at the time