#senpai
1 messages · Page 1 of 1 (latest)
You can do that when creating via the API. Otherwise the Dashboard restricts versioning to your current account default, and the latest API version (if different)
where do i go? just the developer dashboard? i don’t see an option to change webhook api versions
As stated, you'll need to use the API to create a webhook if you want to pin to a specific version: https://stripe.com/docs/api/webhook_endpoints/create#create_webhook_endpoint-api_version
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The Dashboard doesn't allow this as it's generally not recommended to have a webhook version fixed to a version different to your account version
so I'll have to create one within my app?
Yes
so in the docs its
const webhookEndpoint = await stripe.webhookEndpoints.create({
url: 'https://example.com/my/webhook/endpoint',
enabled_events: [
'charge.failed',
'charge.succeeded',
],
});
``` and it says optional "api_version", do I do something along the lines of
const webhookEndpoint = await stripe.webhookEndpoints.create({
url: 'https://example.com/my/webhook/endpoint',
api_version: '2020-08-27
enabled_events: [
'charge.failed',
'charge.succeeded',
],
});
Yep, exactly
But why do you want a webhook with a version different to your account default?
I wrote an app that generate invoices using the stripe api, but it was created on an older api version and now when using the current version, I get 400 error on the "invoice.payment_succeeded" event when having my discord bot listen for if the invoice was paid or not
What is the specific error thrown in your webhook handler?
Right, but that 400 error is returned to us from your webhook handler code. There must be an exception thrown in your code
idk what it could be because the only thing that was changed within the code was other than the api key, that was genuinely the only change I made
Yes but there's breaking changes between API versions, so depending on the logic in your webhook handler, something could have changed unexpectedly. For example: https://stripe.com/docs/upgrades#api-versions
My recommendation would be to figure out what the error is, and instead of creating a webhook for the old version, fix the bug if you intend to stay on 2022-11-15