I want to test my API behaviour by triggering some specific requests using Stripe CLI.
For example:
stripe trigger customer.subscription.deleted # with some fixture here
There is a fixtures command documented as a feature but I do not know how to use it. The documentation says:
The fixtures command lets you run a json file as a series of API requests. This can be useful for things like filling data, executing specific flows, or testing API behavior.
https://github.com/stripe/stripe-cli/wiki/fixtures-command
How do I load fixtures into the CLI?
The first step is to create a JSON file with the fixtures in it. The documentation you linked to gives one such example, but it may make it easier for you to get started if you:
You can then execute the fixture with stripe fixtures name_of_your_fixture_file.json
You can look up available triggers in the trigger documentation. Remember that fixtures are just going to make a series of API requests, with each object in the fixtures
array representing one API call, so you can do anything specified in the API docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With