stripe-cli: `--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)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
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…
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).
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?
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
(Though this isn’t 100% correct – when setting up a webhook endpoint, or when using
stripe listenwith the--latestflag, 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).
Unfortunately, due to technical constraints on the backend, the
listencommand can only support two different API versions:--latest(or-l) flagRelatedly, the
triggercommand also doesn’t support specific API versions. The events are formatted by Stripe’s backend servers:stripe listencommand, then events will be formatted as explained aboveFor 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.