Blog

Partager cet article sur Twitter

Stripe CLI

Tomer Elmalem on November 5, 2019

Building and testing a Stripe integration can require frequent switching between the terminal, your code editor, and the Dashboard. Today, we’re excited to launch the Stripe command-line interface (CLI). It lets you interact with Stripe right from the terminal and makes it easier to build, test, and manage your integration.

To start, the CLI will let you test webhooks, tail real-time API logs, and create or update API objects. Here’s a preview of some of the features:

Simplify webhook setup and testing

Stripe sends a variety of webhooks, which let you listen and respond to specific events programmatically. Run stripe listen with the CLI to forward webhooks to your local web server during development—no third-party tunneling tools required. You can also trigger and test specific webhook events with stripe trigger.

Debug faster with real-time logs

While integrating, it can be useful to look at logs to fix any issues. You can now use stripe logs tail to stream API request logs in real time in the terminal in addition to viewing these logs from the Dashboard. Quickly inspect parameters or JSON responses and debug errors as they happen.

Speed up common tasks and workflows

You can now create, retrieve, update, or delete any Stripe object directly from the CLI in both test and live mode. For example, you can use stripe customers create and specify parameters for properties inline.

Since you can pipe results into other commands, this can be a simple and powerful way to automate tasks. Here’s an example:


$ stripe subscriptions list \
    --live \
    --status past_due \
    --expand data.customer | \
  jq -r ".data[] | [.customer.name, .customer.email] | @csv"

The above command uses the CLI to list live subscriptions that are past due, pipes the JSON response to jq to extract the customer name and email, and exports the data in CSV format.

To see a full list of supported commands, run stripe help or visit the docs to learn more.

Getting started

The Stripe CLI natively supports macOS, Windows, and Linux. You can also pull our Docker image to use in automated testing or a continuous integration setup.

We’re just getting started and we’ll be adding a lot more features to the CLI. If you have feedback or feature requests, join the conversation on GitHub. You can also run stripe feedback to share your ideas for which use cases we should tackle next.

You’re viewing our website for Greece, but it looks like you’re in the United States. Switch to the United States site