-
Notifications
You must be signed in to change notification settings - Fork 385
Resource commands
You can easily make API requests using the CLI:
$ stripe charges retrieve ch_123
$ stripe charges create --amount=100 --currency=usd --source=tok_visa
$ stripe charges update ch_123 -d "metadata[key]=value"
For a full list of available resources, type stripe resources
or the wiki page.
The CLI has three commands that let you interact with the Stripe API in test mode. You can easily make GET
, POST
, and DELETE
commands with the Stripe CLI.
For example, you can retrieve a specific charge:
$ stripe get /charges/ch_123
You can also pass data in using the -d
flag:
$ stripe post /charges -d amount=100 -d source=tok_visa -d currency=usd
These commands support many of the features on the Stripe API (e.g. selecting a version, pagination, and expansion) through command-line flags, so you won't need to provide specific headers. For a full list of supported flags, see the wiki page.
You can pipe the output of these commands to other tools. For example, you could use jq to extract information from JSON the API returns, and then use that information to trigger other API requests.
Here’s a simple example that lists past_due
subscriptions, extracts the IDs, and cancels those subscriptions:
$ stripe get /subscriptions -d status=past_due | jq ".data[].id" | xargs -I % -p stripe delete /subscriptions/%