#senpai

1 messages · Page 1 of 1 (latest)

rustic oysterBOT
placid zodiac
#

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)

quaint dock
#

where do i go? just the developer dashboard? i don’t see an option to change webhook api versions

placid zodiac
#

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

quaint dock
#

so I'll have to create one within my app?

placid zodiac
#

Yes

quaint dock
#

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',
],
});

placid zodiac
#

Yep, exactly

#

But why do you want a webhook with a version different to your account default?

quaint dock
#

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

placid zodiac
#

What is the specific error thrown in your webhook handler?

quaint dock
#

this is the new api version

#

and this is the old version

placid zodiac
#

Right, but that 400 error is returned to us from your webhook handler code. There must be an exception thrown in your code

quaint dock
#

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

placid zodiac
#

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