`--api-version` not working
stripe listen --api-version 2019-09-09 results in:
unknown flag: --api-version
The same goes for stripe trigger checkout.session.completed --api-version 2019-09-09
Second issue:
It looks like Stripe CLI is defaulting to the 2019-03-14 API version, not to my currently used API version.
I have:
stripe version 0.6.12 (beta)
Unfortunately, due to technical constraints on the backend, the listen command can only support two different API versions:
- by default, events will be formatted according to your account's default API version (which you can view at https://dashboard.stripe.com/developers)
- alternatively, you can request that events be formatted with the latest API version by using the
--latest(or-l) flag
Relatedly, the trigger command also doesn't support specific API versions. The events are formatted by Stripe's backend servers:
- if you're receiving events via the
stripe listencommand, then events will be formatted as explained above - if you're receiving events via a regular webhook endpoint, then events will be formatted according to the endpoint's API version
Second issue: It looks like Stripe CLI is defaulting to the 2019-03-14 API version, not to my currently used API version.
For the trigger command, yes, API requests that are sent by the CLI in order to trigger the requested event do use that API version. But that doesn't control the API version that will be used to format the event object you receive on your endpoint.
I think what you're saying conflicts with the docs at https://stripe.com/docs/stripe-cli#api-requests - doesn't it?
No. When using API requests commands (e.g. stripe charges create, stripe customers update, etc.), you can specify any API version. This controls which parameters are accepted in the request, and how the API response is formatted.
However, it doesn't control which API version will be used to format the resulting event (if any). This is briefly mentioned here: https://stripe.com/docs/api/versioning
Note that events generated by API requests will always be structured according to your account API version.
(Though this isn't 100% correct -- when setting up a webhook endpoint, or when using stripe listen with the --latest flag, you can request that events be formatted with the latest API version instead of your account's default version.)
This is how events work in Stripe's API and is not specific to the CLI.
Can you clarify your usecase? In nearly all cases, you want events to be formatted with your account's default API version (or the latest, when you're preparing to upgrade your account's default API version to the latest).
No real use case, I just noticed some usage of the 2019-03-14 API version in my dashboard (test mode) after starting to use the CLI, and was wondering if I'm doing something wrong. My default is 2019-09-09.
Anyway, I guess it's not too important, so if you think it's not a bug, and the docs are correct, you can close this ;-)
FWIW, this is an issue for us, as well. Our use case was we were prepared to update to a more recent version of the Stripe API (but not latest).
this is an issue for us too. After a stripe account migration, our account default version is after the version we are using. So I can't test webhooks locally..
Just adding another +1 here that this is an issue for us too. Would be nice to be able to fetch events with a given API version, either through the Stripe CLI or through Events.List API call (which also currently suffers from this same limitation)
+1. It's a real issue that API version can't be specified for the stripe listen command.
+1 This would be very useful to test upgrading to a more recent stripe version which is not the latest.
+1 Also blocking for local development
I am listening the events with stripe listen --latest but still the event that i am getting has the property apiVersion: 2017-02-14 which is my default version on the dashboard?
this wouldn't be so bad if not for the inability to incrementally update the accounts default API version, forcing users to go from some version all the way to latest seriously sucks
had this same problem with a recent 2022-version i need to use to test with. and for some reason it defaults to the 4 year old version on the cli.
Also blocking. :)
Same problem here. I have a project running on API version of 2020, I try to test it with sandbox, but I'm on a new account with latest version and of course it doesn't work. I don't want to use the sandbox from production account because it's a security risk and I don't want to upgrade my API version, because it might introduce bugs.
Is there any hope you might reconsider changing this behaviour?
this is so annoying
Still no fix for this? Ugghhh
no fix yet? quite amusing!
Looking for this feature too...
this is an issue for me also, trying to local listen to a beta API webhook and I can't specify the beta API version so I can't test this???