# Stripe CLI reference

## Stripe CLI reference

This reference documents every command and flag available in Stripe’s command-line interface.

The Stripe CLI helps you build, test, and manage your Stripe integration right from the terminal.

With the CLI, you can:
- Create, retrieve, update, and delete [API objects](https://docs.stripe.com/cli/resources.md).
- [Tail API request logs](https://docs.stripe.com/cli/logs/tail.md) in real time.
- [Securely test webhooks](https://docs.stripe.com/cli/listen.md) without relying on third-party tunneling software.

Follow the [installation guide](https://docs.stripe.com/stripe-cli.md#install) to set up the Stripe CLI.

## login

Connect the CLI to your Stripe account by logging in to persist your secret key locally.

The Stripe CLI runs commands using a global configuration or project-specific configurations. To configure the CLI globally, run:

```sh
stripe login
```

You'll be redirected to the Dashboard to confirm that you want to give the CLI access to your account. After confirming, a new API key will be created for the CLI.

> All configurations are stored in `~/.config/stripe/config.toml`, including login credentials. You can use the [`XDG_CONFIG_HOME`](https://wiki.archlinux.org/index.php/XDG_Base_Directory) environment variable to override this location. The configuration file is not automatically removed when the CLI is uninstalled.

**Command:** `stripe login`

### Flags

- `-i, --interactive`
  Use interactive configuration mode if you cannot open a browser and would like to manually provide an API key.

- `--project-name=<project>`
  You can create project-specific configurations with the `--project-name` flag, which can be used in any context.
If you do not provide the `--project-name` flag for a command, it will default to the global configuration.

### Examples

**Basic login**

```sh
stripe login
```

**Log in and specify a project**

```sh
stripe login --project-name=rocket-rides
```

```
Your pairing code is: excels-champ-wins-quaint
This pairing code verifies your authentication with Stripe.
Press Enter to open the browser
...
```

**Log in using interactive mode**

```sh
stripe login --interactive
```

```
Enter your API key:
Your API key is: sk_******************************p7dc
...
```

## Using Stripe API keys

The Stripe CLI supports several different ways to set and use [API keys](https://docs.stripe.com/keys.md):

1. [`stripe login`](https://docs.stripe.com/cli/login.md)
2. [`stripe config`](https://docs.stripe.com/cli/config.md)
3. [`--api-key` flag](https://docs.stripe.com/cli/api_keys.md)
4. Environment variables

Each supports a different use case. `stripe login` is the easiest and recommended way to get started. Running this command will prompt you to log in from your browser and persist your API key locally, rather than requiring it for each command. If you want to provide an API key manually, you can use `stripe login --interactive`.

Using `stripe config` allows you to set persistent keys manually:
- `stripe config --set test_mode_api_key sk_test_123`

`--api-key` is a global flag that overrides your local configuration if you need to run one-off commands with a specific API key.

You can set two environment variables, which take precedence over all other values:

- `STRIPE_API_KEY`: the API key to use for the CLI.
- `STRIPE_DEVICE_NAME`: the device name for the CLI, visible in the Dashboard.

### Example

```title
Running commands with a specified API key
```

## config

Use the `config` command to manually set configuration options for the
CLI. The `config` command supports:

* Setting options
* Unsetting options
* Listing all configured options
* Opening the configuration file with your default editor

All commands support the `--project-name` global flag. You can define a unique configuration for individual projects.

**Command:** `stripe config`

### Flags

- `-e, --edit`
  Opens the configuration file in your default editor.

- `--list`
  Lists all configured options (including defaults).

- `--set <option> <value>`
  Set a value for the specified configuration option.

- `--unset <option>`
  Unset the configuration option and remove the key-value pair from the configuration file.

### Examples

**Set a configuration option**

```sh
stripe config --set color on
```

**Unset a configuration option**

```sh
stripe config --unset color
```

**List the currently configured options**

```sh
stripe config --list
```

```
color = "on"

[default]
  device_name = "st-stripe1"
  live_mode_api_key = "rk_live_abc123"
  live_mode_publishable_key = "pk_live_abc123"
  test_mode_api_key = "rk_test_abc123"
  test_mode_publishable_key = "pk_test_abc123"
```

## completion

The Stripe CLI supports autocompletion for macOS and Linux to make it easier to use the right commands with the CLI with the Bash and ZSH shells.

Set up autocompletion by running `stripe completion`. Depending on your platform and shell, relevant instructions will be displayed.

Details around setting up autocompletion can be also found in the [Terminal Autocompletion](https://docs.stripe.com/stripe-cli/configure.md#autocompletion) section of our configuration guide.

> Shell completion scripts are not currently supported on Windows.

**Command:** `stripe completion`

### Flags

- `--shell <platform>`
  The shell for which autocompletion commands will be generated. By default the CLI will attempt to autodetect the platform.
    - `bash`
      Use for Bash environments.
    - `zsh`
      Use for ZSH environments.

### Examples

**Basic usage**

```sh
stripe completion
```

**Specifying a shell**

```sh
stripe completion --shell zsh
```

## Global Flags

The Stripe CLI supports a number of flags for every command.

**Command:** `stripe {command} <arguments>`

### Flags

- `--api-key <stripe_api_key>`
  Use the Stripe account associated with this Stripe API secret key.

- `--color <setting>`
  Enable or disable color output.
    - `on`
      Enable color output.
    - `off`
      Disable color output.
    - `auto`
      Use the default output color based on global settings.

- `--config <config_filepath>`
  Use this file path for the CLI's configuration file (default: `$HOME/.config/stripe/config.toml`).

- `--device-name <name>`
  Run this command on behalf of another device.

- `-h, --help`
  Provides the help documentation for a given command, including the supported flags and arguments.

- `--log-level <level>`
  Set the level of detail for log messages (default: `info`)
    - `debug`
      Useful for development purposes.
    - `info`
      Shows standard logs that come up.
    - `warn`
      Shows warnings that are detected.
    - `error`
      Shows every log including errors that arise.

- `-p, --project-name <name>`
  Define a project name for the CLI's current configuration. Using the `--project-name` flag enables multiple configurations across Stripe accounts (stored within one configuration file), and any command can run in the context of a project (default: `"default"`).

- `-v, --version`
  Prints the version of the Stripe CLI. This flag is meant to run without any other flags or arguments set.

## Stripe commands

Inspect details about your Stripe integration, logs, and service availability.

## logs tail

Establishes a direct connection with Stripe, allowing you to tail your test mode Stripe API request logs in real-time from your terminal.

Multiple filters can be used together and a log entry must match all filters to be shown.

When specifying a filter, multiple values can be provided as a comma-separated list. A log entry only needs to match one of the values.

> `logs tail` only supports displaying *test mode* request logs.

**Command:** `stripe logs tail`

### Flags

- `--filter-account <values>`
  Filter request logs by the source and destination account.
    - `connect_in`
      Incoming Connect requests.
    - `connect_out`
      Outgoing Connect requests.
    - `self`
      Non-Connect requests.

- `--filter-http-method <values>`
  Filter request logs by HTTP method.
    - `GET`
      HTTP GET requests.
    - `POST`
      HTTP POST requests.
    - `DELETE`
      HTTP DELETE requests.

- `--filter-ip-address <values>`
  Filter request logs by IP address.

- `--filter-request-path <values>`
  Filter request logs that directly match any Stripe path (e.g. `/v1/charges`).

- `--filter-request-status <values>`
  Filter request logs by the response status.
    - `SUCCEEDED`
      Requests that succeeded (HTTP 200, 201, 202 status codes).
    - `FAILED`
      Requests that failed (HTTP 4xx and 5xx status codes).

- `--filter-source <values>`
  Filter request logs by the source of each request.
    - `API`
      Requests created with the Stripe API.
    - `DASHBOARD`
      Requests created from the Dashboard.

- `--filter-status-code <values>`
  Filter request logs by HTTP status code.

- `--filter-status-code-type <values>`
  Filter request logs by the type of HTTP status code.
    - `2XX`
      HTTP 2xx status codes.
    - `4XX`
      HTTP 4xx status codes.
    - `5XX`
      HTTP 5xx status codes.

- `--format <value>`
  Specifies the output format for request logs.
    - `JSON`
      Output logs in JSON format.

### Examples

**Basic usage**

```sh
stripe logs tail
```

```
> Ready! You're now waiting to receive API request logs
2022-01-28 09:47:46 [200] POST /v1/customers [req_abc123]
2022-01-28 09:48:22 [200] POST /v1/charges [req_def456]
2022-01-28 09:48:58 [200] POST /v1/charges [req_ghi789]
...
```

**Use multiple log filters**

```sh
stripe logs tail \
    --filter-http-method POST \
    --filter-status-code-type 4XX
```

**Use multiple values for log filters**

```sh
stripe logs tail --filter-http-method GET,POST
```

## open

Shortcut to open the Stripe documentation or Dashboard in your browser.

> Any Dashboard pages (that include `/test/` in the URL) can be viewed in live mode with the `--live` flag.

**Command:** `stripe open`

### Arguments

- `<shortcut>`
  Shortcut used to quickly open a page on [stripe.com](https://stripe.com).
    - `api`
      https://docs.stripe.com/api
    - `apiref`
      https://docs.stripe.com/api
    - `cliref`
      https://docs.stripe.com/cli
    - `dashboard`
      https://dashboard.stripe.com/test
    - `dashboard/apikeys`
      https://dashboard.stripe.com/test/apikeys
    - `dashboard/atlas`
      https://dashboard.stripe.com/test/atlas
    - `dashboard/balance`
      https://dashboard.stripe.com/test/balance/overview
    - `dashboard/billing`
      https://dashboard.stripe.com/test/billing
    - `dashboard/connect`
      https://dashboard.stripe.com/test/connect/overview
    - `dashboard/connect/accounts`
      https://dashboard.stripe.com/test/connect/accounts/overview
    - `dashboard/connect/collected`
      https://dashboard.stripe.com/test/connect/application_fees
    - `dashboard/connect/transfers`
      https://dashboard.stripe.com/test/connect/transfers
    - `dashboard/coupons`
      https://dashboard.stripe.com/test/coupons
    - `dashboard/customers`
      https://dashboard.stripe.com/test/customers
    - `dashboard/developers`
      https://dashboard.stripe.com/test/developers
    - `dashboard/disputes`
      https://dashboard.stripe.com/test/disputes
    - `dashboard/events`
      https://dashboard.stripe.com/test/events
    - `dashboard/invoices`
      https://dashboard.stripe.com/test/invoices
    - `dashboard/logs`
      https://dashboard.stripe.com/test/logs
    - `dashboard/orders`
      https://dashboard.stripe.com/test/orders
    - `dashboard/orders/products`
      https://dashboard.stripe.com/test/orders/products
    - `dashboard/payments`
      https://dashboard.stripe.com/test/payments
    - `dashboard/payouts`
      https://dashboard.stripe.com/test/payouts
    - `dashboard/radar`
      https://dashboard.stripe.com/test/radar
    - `dashboard/radar/list`
      https://dashboard.stripe.com/test/radar/list
    - `dashboard/radar/reviews`
      https://dashboard.stripe.com/test/radar/reviews
    - `dashboard/radar/rules`
      https://dashboard.stripe.com/test/radar/rules
    - `dashboard/settings`
      https://dashboard.stripe.com/settings
    - `dashboard/subscriptions`
      https://dashboard.stripe.com/test/subscriptions
    - `dashboard/products`
      https://dashboard.stripe.com/test/products
    - `dashboard/tax`
      https://dashboard.stripe.com/test/tax-rates
    - `dashboard/terminal`
      https://dashboard.stripe.com/test/terminal
    - `dashboard/terminal/hardware/orders`
      https://dashboard.stripe.com/test/terminal/hardware_orders
    - `dashboard/terminal/locations`
      https://dashboard.stripe.com/test/terminal/locations
    - `dashboard/topups`
      https://dashboard.stripe.com/test/topups
    - `dashboard/transactions`
      https://dashboard.stripe.com/test/balance
    - `dashboard/webhooks`
      https://dashboard.stripe.com/test/webhooks
    - `docs`
      https://docs.stripe.com/

### Flags

- `--list`
  List all supported shortcuts.

- `--live`
  Open the Dashboard for your live integration (by default, runs in test mode).

### Examples

**Basic usage**

```sh
stripe open dashboard/webhooks
```

**Open the Dashboard in live mode**

```sh
stripe open dashboard/apikeys --live
```

**List available shortcuts in live mode**

```sh
stripe open --live --list
```

```
open supports the following shortcuts:

shortcut                              url
--------                              ---------
api               => https://docs.stripe.com/api
apiref            => https://docs.stripe.com/api
cliref            => https://docs.stripe.com/cli
dashboard         => https://dashboard.stripe.com
dashboard/apikeys => https://dashboard.stripe.com/apikeys
dashboard/atlas   => https://dashboard.stripe.com/atlas
...
```

## Webhook commands

Listen for [webhook events](https://docs.stripe.com/webhooks.md) and forward them to your application. Trigger and resend webhook events.

## listen

Receive webhook events from Stripe on your local machine via a direct connection to Stripe's API. The `listen` command can receive events based on your account's default API version or the latest version, filter by type of event, or forward events to an application running on a given port.

By default, `listen` accepts all snapshot webhook events and displays them in
your terminal. In order to listen to thin events, you must pass them in via `--thin-events`.

> You don't need to configure any webhook endpoints in your Dashboard to receive webhooks with the CLI.
> 
> The webhook signing secret provided will not change between restarts to the `listen` command.

**Command:** `stripe listen`

### Flags

- `-e, --events <events types>`
  A comma-separated list of which snapshot events to listen for. The [event types documentation](https://docs.stripe.com/api/events/types.md) includes a complete list (default: `[*]` for all events).

- `-f, --forward-to <url>`
  The URL that snapshot webhook events will be forwarded to. Returns a [webhook signing secret](https://docs.stripe.com/webhooks/signatures.md) which you can add to your application's configuration.

- `-H, --headers <values>`
  A comma-separated list of custom HTTP headers to forward.

Ex: `"Key1:Value1, Key2:Value2"`

- `-c, --forward-connect-to <url>`
  The URL that Connect webhook events will be forwarded to. By default, the same URL will be used for all snapshot webhook events.

- `--connect-headers <values>`
  A comma-separated list of custom HTTP headers to forward to any connected accounts. This is useful when testing a [Connect](https://docs.stripe.com/connect.md) platform.

Ex: `"Key1:Value1, Key2:Value2"`

- `--thin-events <events types>`
  A comma-separated list of which thin events to listen for. The [event types documentation](https://docs.stripe.com/api/v2/core/events/event-types.md) includes a complete list. Use `*` for all events. (default: none).

- `--forward-thin-to <url>`
  The URL that thin webhook events will be forwarded to. Returns a [webhook signing secret](https://docs.stripe.com/webhooks/signatures.md) which you can add to your application's configuration.

- `--forward-thin-connect-to <url>`
  The URL that thin Connect webhook events will be forwarded to. By default, the same URL will be used for all thin webhook events.

- `-l, --latest`
  Receive events used in the latest API version. By default, webhook events received will depend on your account's default API version.

- `--live`
  Make a live request (by default, runs in test mode).

- `-a, --load-from-webhooks-api`
  Listen for all webhook events based on your existing webhook endpoints configured in the Dashboard and API.

- `-j, --print-json`
  Print JSON objects to stdout.

- `--print-secret`
  Only print the webhook signing secret and exit.

- `--skip-verify`
  Skip certificate verification when forwarding to HTTPS endpoints.

### Examples

**Basic usage**

```sh
stripe listen
```

```
> Ready! Your webhook signing secret is whsec_abcdefg1234567
2022-01-28 09:47:46   --> customer.created [evt_abc123]
2022-01-28 09:48:22   --> charge.succeeded [evt_def456]
2022-01-28 09:48:58   --> charge.succeeded [evt_ghi789]
```

**Forward webhook events to an application**

```sh
stripe listen --forward-to http://localhost:4242
```

**Filter webhook events by type**

```sh
stripe listen --events=payment_intent.succeeded
```

## trigger

[Trigger example webhook events](https://docs.stripe.com/stripe-cli/triggers.md) to conduct local testing. These test webhook events are based on real API objects and may trigger other webhook events as part of the test (for example, triggering `payment_intent.succeeded` also triggers `payment_intent.created`).


The [event types documentation](https://docs.stripe.com/api/events/types.md) includes a complete list of webhook events and when they would be triggered.

> Events are triggered by issuing HTTP requests against the Stripe API. Because of this, triggering events causes side effects: all necessary API objects will be created in the process.

**Command:** `stripe trigger`

### Arguments

- `<event>`
  The webhook events we currently support are listed below (or using `stripe help trigger`):
    - `account.application.deauthorized`
      Occurs whenever a user deauthorizes an application. Sent to the related application only. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-account.application.deauthorized).
    - `account.updated`
      Occurs whenever an account status or property has changed. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-account.updated).
    - `balance.available`
      Occurs whenever your Stripe balance has been updated (e.g., when a charge is available to be paid out). By default, Stripe automatically transfers funds in your balance to your bank account on a daily basis. This event is not fired for negative transactions. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-balance.available).
    - `charge.captured`
      Occurs whenever a previously uncaptured charge is captured. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-charge.captured).
    - `charge.dispute.created`
      Occurs whenever a customer disputes a charge with their bank. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-charge.dispute.created).
    - `charge.failed`
      Occurs whenever a failed charge attempt occurs. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-charge.failed).
    - `charge.refunded`
      Occurs whenever a charge is refunded, including partial refunds. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-charge.refunded).
    - `charge.refund.updated`
      Occurs whenever a refund is updated, on selected payment methods. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-charge.refund.updated).
    - `charge.succeeded`
      Occurs whenever a new charge is created and is successful. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-charge.succeeded).
    - `checkout.session.async_payment_failed`
      Occurs when a payment intent using a delayed payment method fails. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-checkout.session.async_payment_failed).
    - `checkout.session.async_payment_succeeded`
      Occurs when a payment intent using a delayed payment method finally succeeds. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-checkout.session.async_payment_succeeded).
    - `checkout.session.completed`
      Occurs when a Checkout Session has been successfully completed. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-checkout.session.completed).
    - `customer.created`
      Occurs whenever a new customer is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-customer.created).
    - `customer.deleted`
      Occurs whenever a customer is deleted. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-customer.deleted).
    - `customer.source.created`
      Occurs whenever a new source is created for a customer. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-customer.source.created).
    - `customer.source.updated`
      Occurs whenever a source's details are changed. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-customer.source.updated).
    - `customer.subscription.created`
      Occurs whenever a customer is signed up for a new plan. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-customer.subscription.created).
    - `customer.subscription.deleted`
      Occurs whenever a customer's subscription ends. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-customer.subscription.deleted).
    - `customer.subscription.updated`
      Occurs whenever a subscription changes (e.g., switching from one plan to another, or changing the status from trial to active). Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-customer.subscription.updated).
    - `customer.updated`
      Occurs whenever any property of a customer changes. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-customer.updated).
    - `invoice.created`
      Occurs whenever a new invoice is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-invoice.created).
    - `invoice.finalized`
      Occurs whenever a draft invoice is finalized and updated to be an open invoice. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-invoice.finalized).
    - `invoice.paid`
      Occurs whenever an invoice payment attempt succeeds or an invoice is marked as paid out-of-band. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-invoice.paid).
    - `invoice.payment_action_required`
      Occurs whenever an invoice payment attempt requires further user action to complete. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-invoice.payment_action_required).
    - `invoice.payment_failed`
      Occurs whenever an invoice payment attempt fails, due either to a declined payment or to the lack of a stored payment method. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-invoice.payment_failed).
    - `invoice.payment_succeeded`
      Occurs whenever an invoice payment attempt succeeds. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-invoice.payment_succeeded).
    - `invoice.updated`
      Occurs whenever an invoice changes (e.g., the invoice amount). Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-invoice.updated).
    - `issuing_authorization.request`
      Represents a synchronous request for authorization. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-issuing_authorization.request).
    - `issuing_card.created`
      Occurs whenever a card is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-issuing_card.created).
    - `issuing_cardholder.created`
      Occurs whenever a cardholder is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-issuing_cardholder.created).
    - `payment_intent.amount_capturable_updated`
      Occurs when a PaymentIntent has funds to be captured. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.amount_capturable_updated).
    - `payment_intent.canceled`
      Occurs when a PaymentIntent is canceled. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.canceled).
    - `payment_intent.created`
      Occurs when a new PaymentIntent is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.created).
    - `payment_intent.partially_funded`
      Occurs when funds are applied to a customer_balance PaymentIntent and the `amount_remaining` changes. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.partially_funded).
    - `payment_intent.payment_failed`
      Occurs when a PaymentIntent has failed the attempt to create a payment method or a payment. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.payment_failed).
    - `payment_intent.requires_action`
      Occurs when a PaymentIntent transitions to requires_action state. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.requires_action).
    - `payment_intent.succeeded`
      Occurs when a PaymentIntent has successfully completed payment. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.succeeded).
    - `payment_link.created`
      Occurs when a payment link is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_link.created).
    - `payment_link.updated`
      Occurs when a payment link is updated. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_link.updated).
    - `payment_method.attached`
      Occurs whenever a new payment method is attached to a customer. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_method.attached).
    - `payment_method.detached`
      Occurs whenever a new payment method is detached from a customer. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payment_method.detached).
    - `payout.created`
      Occurs whenever a payout is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payout.created).
    - `payout.updated`
      Occurs whenever a payout is updated. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-payout.updated).
    - `plan.created`
      Occurs whenever a plan is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-plan.created).
    - `plan.deleted`
      Occurs whenever a plan is deleted. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-plan.deleted).
    - `plan.updated`
      Occurs whenever a plan is updated. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-plan.updated).
    - `price.created`
      Occurs whenever a price is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-price.created).
    - `price.updated`
      Occurs whenever a price is updated. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-price.updated).
    - `product.created`
      Occurs whenever a product is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-product.created).
    - `product.deleted`
      Occurs whenever a product is deleted. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-product.deleted).
    - `product.updated`
      Occurs whenever a product is updated. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-product.updated).
    - `quote.accepted`
      Occurs whenever a quote is accepted. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-quote.accepted).
    - `quote.canceled`
      Occurs whenever a quote is canceled. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-quote.canceled).
    - `quote.created`
      Occurs whenever a quote is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-quote.created).
    - `quote.finalized`
      Occurs whenever a quote is finalized. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-quote.finalized).
    - `reporting.report_run.succeeded`
      Occurs whenever a requested `ReportRun` completed successfully. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-reporting.report_run.succeeded).
    - `setup_intent.canceled`
      Occurs when a SetupIntent is canceled. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.canceled).
    - `setup_intent.created`
      Occurs when a new SetupIntent is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.created).
    - `setup_intent.setup_failed`
      Occurs when a SetupIntent has failed the attempt to setup a payment method. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.setup_failed).
    - `setup_intent.succeeded`
      Occurs when an SetupIntent has successfully setup a payment method. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.succeeded).
    - `subscription_schedule.canceled`
      Occurs whenever a subscription schedule is canceled. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-subscription_schedule.canceled).
    - `subscription_schedule.created`
      Occurs whenever a subscription schedule is created. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-subscription_schedule.created).
    - `subscription_schedule.released`
      Occurs whenever a subscription schedule is released. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-subscription_schedule.released).
    - `subscription_schedule.updated`
      Occurs whenever a subscription schedule is updated. Read more in our [API documentation](https://docs.stripe.com/api/events/types.md#event_types-subscription_schedule.updated).

### Flags

- `--stripe-account`
  Set a header identifying the connected account.

- `--override [resource]:[path1].[path2]=[value]`
  Override the param at `path1.path2` for the `resource`. Example: `--override plan:product.name=overrideName`. To index into an array, use bracket notation: `--override "checkout_session:line_items[0].quantity=10"`. In some shells, you may need to wrap the value in quotes to prevent shell interpretation of special characters like brackets.

- `--add [resource]:[path1].[path2]=[value]`
  Add the param `path1.path2` to the `resource`. Example: `--add payment_intent:customer=customerId`

- `--remove [resource]:[path1].[path2]`
  Remove the param at `path1.path2` from the `resource`. Example: `--remove customer:description`

- `--skip [param]`
  Skip specific steps in the trigger. Example: `--skip cus_jenny_rosen`

- `--edit`
  Edit the fixture directly in your default IDE before triggering. Cannot be used with `--add`, `--remove`, `--override`, or `--skip`.

### Examples

**Triggering an event**

```sh
stripe trigger invoice.payment_succeeded
```

```
Setting up fixture for: customer
Setting up fixture for: invoiceitem
Setting up fixture for: invoice
Setting up fixture for: invoice_pay
Trigger succeeded! Check dashboard for event details.
```

**Listing supported events**

```sh
stripe trigger --help
```

```
Supported events:
  balance.available
  charge.captured
  charge.dispute.created
  charge.failed
  charge.refunded
  charge.succeeded
...
```

## events resend

Resend an event to the CLI's local webhook endpoint. You must pass `--webhook-endpoint=we_123456` to resend the event to a specific webhook endpoint. You can only resend events that have been created within the last 30 days.

**Command:** `stripe events resend`

### Arguments

- `<event_id>`
  The ID of the event to resend.

### Flags

- `--account=<account_id>`
  To resend an event that's sent to a Connect webhook endpoint on a platform, set this flag to the connected account ID associated with the event. You can't use the `--stripe-account` parameter with Connect.

- `-c, --confirm`
  Skip the warning prompt and automatically confirm the command being entered.

- `--dark-style`
  Use a darker color scheme better suited for lighter command-line environments.

- `-e, --expand <value>`
  Response attributes to expand inline (target nested values with `nested[param]=value`).

- `-i, --idempotency <key>`
  Set an idempotency key for the request, preventing the same request from replaying within 24 hours.

- `--live`
  Make a live request (by default, runs in test mode).

- `-s, --show-headers`
  Show response HTTP headers.

- `--stripe-account <account_id>`
  Specify the Stripe account to use for this request.

- `-v, --stripe-version <version>`
  Specify the Stripe API version to use for this request.

- `--webhook-endpoint=<endpoint_id>`
  Resend the event to the given webhook endpoint ID (`we_123456`).

### Examples

**Basic usage**

```sh
stripe events resend evt_1PH9HU2eZvKYlo2CrSrLx8y1
```

**Response**

```
{
  "id": "evt_1PH9HU2eZvKYlo2CrSrLx8y1",
  "object": "event",
  "api_version": "2019-02-19",
  "created": 1715885036,
  "data": {
    "object": {
      "id": "card_1PH9HQ2eZvKYlo2CcwDOwdFV",
      "object": "card",
      "address_city": null,
      "address_country": null,
      "address_line1": null,
      "address_line1_check": null,
      "address_line2": null,
      "address_state": null,
      "address_zip": "12345",
      "address_zip_check": "pass",
      "brand": "Visa",
      "country": "US",
      "customer": "cus_Q7O3jQBjZLlpRL",
      "cvc_check": "pass",
      "dynamic_last4": null,
      "exp_month": 12,
      "exp_year": 2034,
      "fingerprint": "Xt5EWLLDS7FJjR1c",
      "funding": "credit",
      "last4": "4242",
      "metadata": {},
      "name": "user@gmail.com",
      "tokenization_method": null,
      "wallet": null
    }
  },
  "livemode": false,
  "pending_webhooks": 0,
  "request": {
    "id": "req_nqyTqVZmNKel38",
    "idempotency_key": "4bbe6edd-6d4e-4770-bf5a-f006cdf0e394"
  },
  "type": "customer.source.created"
}
```

## Resources & HTTP commands

The Stripe CLI supports two ways to create, update, and list objects based on API resources: resource commands and HTTP commands.

**Resource commands** directly manage API resources and provide different arguments, flags, and functionality based on which API resource is used.

**HTTP commands** are convenient shorthand for HTTP requests to the Stripe API. These requests can operate on individual API objects or lists of objects.

## resources

Resource commands make API requests using the CLI for a given resource. The Stripe CLI has commands to interact with all types of Stripe API resources.

A complete list of available resources and examples are included in the
[API Reference Guide](https://docs.stripe.com/api.md). Select **Stripe CLI** from the language dropdown to see a complete example for each resource.

Use the `help` command on any resource to see what operations you can perform. For example, run `stripe customers --help` to see help for the [Customers](https://docs.stripe.com/api/customers.md) resource.

Use `stripe resources` to see a complete list of available resources.

> All commands support making live requests with the `--live` flag.

**Command:** `stripe {resource command}`

### Arguments

- `<operation>`
  Operation to perform on API object. Each type of API resource includes a set of operations that you can perform (such as `delete`, `list`, and `retrieve`).

### Flags

- `--param=value`
  Parameters to attach to the operation being performed.

- `-d, --data <value>`
  Additional data to send with an API request. Supports setting nested values (e.g `nested[param]=value`).

### Examples

**Listing supported operations**

```sh
stripe customers --help
```

```
Available Operations:
  create
  delete
  list
...
```

**Create a resource**

```sh
stripe customers create \
    --email=billing@example.com \
    --name="Jenny Rosen" \
    --description="My First Test Customer"
```

**Update a resource**

```sh
stripe customers update cus_9s6XKzkNRiz8i3 \
    -d "metadata[key]=value"
```

**Retrieve a resource**

```sh
stripe customers retrieve cus_9s6XKzkNRiz8i3
```

**Response**

```
{
  "id": "cus_9s6XKzkNRiz8i3",
  "object": "customer",
  "address": null,
  "balance": 0,
  "created": 1680893993,
  "currency": null,
  "default_source": null,
  "delinquent": false,
  "description": "My First Test Customer",
  "discount": null,
  "email": "billing@example.com",
  "invoice_prefix": "0759376C",
  "invoice_settings": {
    "custom_fields": null,
    "default_payment_method": null,
    "footer": null,
    "rendering_options": null
  },
  "livemode": false,
  "metadata": {},
  "name": "Jenny Rosen",
  "next_invoice_sequence": 1,
  "phone": null,
  "preferred_locales": [],
  "shipping": null,
  "tax_exempt": "none",
  "test_clock": null
}
```

## get

Make GET HTTP requests to retrieve an individual API object (or set of objects).

You can pipe the output of this command to other tools. For example, you could use [jq](https://stedolan.github.io/jq/) to extract information from JSON the API returns, and then use that information to trigger other API requests.

See the [API reference](https://docs.stripe.com/api.md) for a complete list of supported URL paths.

**Command:** `stripe get`

### Arguments

- `<id>`
  ID of the API object to retrieve.

- `<path>`
  URL path of the API object or set of objects to fetch.

### Flags

- `-c, --confirm`
  Skip the warning prompt and automatically confirm the command being entered.

- `--dark-style`
  Use a darker color scheme better suited for lighter command-line environments.

- `-d, --data <value>`
  Additional data to send with an API request. Supports setting nested values (e.g `nested[param]=value`).

- `-b, --ending-before <object_id>`
  Retrieve the previous page in the list. Pagination uses a cursor that depends on the ID of an object in the list.

- `-e, --expand <value>`
  Response attributes to expand inline (target nested values with `nested[param]=value`).

- `-i, --idempotency <key>`
  Set an idempotency key for the request, preventing the same request from replaying within 24 hours.

- `-l, --limit <number>`
  Number of objects to return, between 1 and 100 (default: 10).

- `--live`
  Make a live request (by default, runs in test mode).

- `-s, --show-headers`
  Show response HTTP headers.

- `-a, --starting-after <object_id>`
  Retrieve the next page in the list. Pagination uses a cursor that depends on the ID of an object in the list.

- `--stripe-account <account_id>`
  Specify the Stripe account to use for this request.

- `-v, --stripe-version <version>`
  Specify the Stripe API version to use for this request.

### Examples

**Get a specific charge by ID**

```sh
stripe get ch_1OKcnt2eZvKYlo2C99k9lfXl
```

**Response**

```
{
  "id": "ch_1OKcnt2eZvKYlo2C99k9lfXl",
  "object": "charge",
  "amount": 1000,
  "amount_captured": 1000,
  "amount_refunded": 0,
  "application": null,
  "application_fee": null,
  "application_fee_amount": null,
  "balance_transaction": "txn_1032Rp2eZvKYlo2CpErRBj09",
  "billing_details": {
    "address": {
      "city": null,
      "country": null,
      "line1": null,
      "line2": null,
      "postal_code": null,
      "state": null
    },
    "email": null,
    "name": null,
    "phone": null
  },
  "calculated_statement_descriptor": "Stripe",
  "captured": true,
  "created": 1701937169,
  "currency": "usd",
  "customer": null,
  "description": "Created by docs.stripe.com/ demo",
  "disputed": false,
  "failure_balance_transaction": null,
  "failure_code": null,
  "failure_message": null,
  "fraud_details": {},
  "invoice": null,
  "livemode": false,
  "metadata": {
    "order_id": "6735"
  },
  "on_behalf_of": null,
  "outcome": {
    "network_status": "approved_by_network",
    "reason": null,
    "risk_level": "normal",
    "risk_score": 23,
    "seller_message": "Payment complete.",
    "type": "authorized"
  },
  "paid": true,
  "payment_intent": "pi_1Gt0RG2eZvKYlo2CtxkQK2rm",
  "payment_method": "pm_1OKcns2eZvKYlo2CKsdIIi44",
  "payment_method_details": {
    "card": {
      "amount_authorized": 1000,
      "brand": "visa",
      "checks": {
        "address_line1_check": null,
        "address_postal_code_check": null,
        "cvc_check": "pass"
      },
      "country": "US",
      "exp_month": 12,
      "exp_year": 2024,
      "extended_authorization": {
        "status": "disabled"
      },
      "fingerprint": "Xt5EWLLDS7FJjR1c",
      "funding": "credit",
      "incremental_authorization": {
        "status": "unavailable"
      },
      "installments": null,
      "last4": "4242",
      "mandate": null,
      "moto": null,
      "multicapture": {
        "status": "unavailable"
      },
      "network": "visa",
      "network_token": {
        "used": false
      },
      "overcapture": {
        "maximum_amount_capturable": 1000,
        "status": "unavailable"
      },
      "three_d_secure": null,
      "wallet": null
    },
    "type": "card"
  },
  "radar_options": {},
  "receipt_email": null,
  "receipt_number": "1684-0467",
  "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xMDMyRDgyZVp2S1lsbzJDKP6nmbIGMga3cB9wS6A6LBZL8h0qdoMC7kO1KupX02DAl5VwFXa4PrlrciExsDqlMq4dJYzVswnEzUi4",
  "redaction": null,
  "refunded": false,
  "refunds": {
    "object": "list",
    "data": [],
    "has_more": false,
    "url": "/v1/charges/ch_1OKcnt2eZvKYlo2C99k9lfXl/refunds"
  },
  "review": null,
  "shipping": null,
  "source_transfer": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "status": "succeeded",
  "transfer_data": null,
  "transfer_group": null
}
```

**List the most recent 50 charges**

```sh
stripe get /v1/charges --limit 50
```

**Cancel past due subscriptions**

```sh
stripe get /v1/subscriptions -d status=past_due \
    | jq ".data[].id" \
    | xargs -I % -p stripe delete /subscriptions/%'
```

## post

Make POST HTTP requests to the Stripe API. The `post` command supports API features like idempotency keys and expandable objects.

See the [API reference](https://docs.stripe.com/api.md) for a complete list of supported URL paths.

**Command:** `stripe post`

### Arguments

- `<path>`
  URL path of the API object to either create or update.

### Flags

- `-c, --confirm`
  Skip the warning prompt and automatically confirm the command being entered.

- `--dark-style`
  Use a darker color scheme better suited for lighter command-line environments.

- `-d, --data <value>`
  Additional data to send with an API request. Supports setting nested values (e.g `nested[param]=value`).

- `-e, --expand <value>`
  Response attributes to expand inline (target nested values with `nested[param]=value`).

- `-i, --idempotency <key>`
  Set an idempotency key for the request, preventing the same request from replaying within 24 hours.

- `--live`
  Make a live request (by default, runs in test mode).

- `-s, --show-headers`
  Show response HTTP headers.

- `--stripe-account <account_id>`
  Specify the Stripe account to use for this request.

- `-v, --stripe-version <version>`
  Specify the Stripe API version to use for this request.

### Examples

**Create a payment intent**

```sh
stripe post /v1/payment_intents \
    -d amount=2000 \
    -d currency=usd \
    -d "payment_method_types[]=card"
```

**Response**

```
{
  "id": "pi_1Gt0Ix2eZvKYlo2CwZBLZZfa",
  "object": "payment_intent",
  "amount": 2000,
  "amount_capturable": 0,
  "amount_details": {
    "tip": {}
  },
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "automatic_payment_methods": null,
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "client_secret": "pi_1Gt0Ix2eZvKYlo2CwZBLZZfa_secret_3LwqYVg0STglik0tqpkBQodvA",
  "confirmation_method": "automatic",
  "created": 1591919971,
  "currency": "usd",
  "customer": null,
  "description": "Created by docs.stripe.com/ demo",
  "invoice": null,
  "last_payment_error": null,
  "latest_charge": null,
  "livemode": false,
  "metadata": {},
  "next_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_configuration_details": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "mandate_options": null,
      "network": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "processing": null,
  "receipt_email": null,
  "redaction": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "status": "requires_payment_method",
  "transfer_data": null,
  "transfer_group": null
}
```

## delete

Make DELETE HTTP requests to the Stripe API.

See the [API reference](https://docs.stripe.com/api.md) for a complete list of supported URL paths.

**Command:** `stripe delete`

### Arguments

- `<path>`
  URL path of the API object to delete.

### Flags

- `-c, --confirm`
  Skip the warning prompt and automatically confirm the command being entered.

- `--dark-style`
  Use a darker color scheme better suited for lighter command-line environments.

- `-d, --data <value>`
  Additional data to send with an API request. Supports setting nested values (e.g `nested[param]=value`).

- `-e, --expand <value>`
  Response attributes to expand inline (target nested values with `nested[param]=value`).

- `-i, --idempotency <key>`
  Set an idempotency key for the request, preventing the same request from replaying within 24 hours.

- `--live`
  Make a live request (by default, runs in test mode).

- `-s, --show-headers`
  Show response HTTP headers.

- `--stripe-account <account_id>`
  Specify the Stripe account to use for this request.

- `-v, --stripe-version <version>`
  Specify the Stripe API version to use for this request.

### Examples

**Delete a customer**

```sh
stripe delete /v1/customers/cus_9s6XKzkNRiz8i3
```

```
Are you sure you want to perform the command: DELETE?
Enter 'yes' to confirm:
```

**Response**

```
{
  "id": "cus_9s6XKzkNRiz8i3",
  "object": "customer",
  "deleted": true
}
```

## fixtures

Use a JSON file to issue a series of API requests. This can be useful when generating sample data, executing specific flows, or testing API behavior.

The structure of the JSON file outlines the set of requests to perform, known as _fixture requests_. When you specify a request's `name`, the CLI stores the response so you can reference the output in subsequent requests. The `path` property specifies the Stripe URL route for the API resource used in the request (e.g. `/v1/customers`).

For example, to reference the response for the request named `json_path`:

- Accessing attributes in responses: `${name:json_path}`
- Accessing environment variables: `${.env:VARIABLE_NAME|<optional default value>}`

Fixture queries must start with `${` and end with `}` and can be included in fixture requests. `name` is the name of the request assigned as part of the fixture (`fixtures[].name`) and `json_path` is a dot-path to the specific variable requested. For example:

- Use `${cus_jenny_rosen:id}` to access a top-level attribute.
- Use `${cus_jenny_rosen:billing_details.address.country}` to access nested data.
- Use `{cus_jenny_rosen:subscriptions.data.#.id}` to access data within a list at index #.
- Use `${.env:PHONE}` to access environment variables (supports `.env` files).

Environment variables can specify default values with the pipe character (`|`). For example:

- `${.env:EMAIL|jane@stripe.com}`
- `${.env:CUSTOMER|cus_1234}`

**Command:** `stripe fixtures`

### Arguments

- `<filepath>`
  Use the JSON file at the given path that includes fixture requests to run.

### Fields

- `_meta`
  Metadata used by CLI during execution.
    - `template_version`
      Version of the template that is running (enables us to support potentially backwards-incompatible changes).

- `fixtures`
  List of requests to execute.
    - `name`
      Name of the request, used to later reference the response
    - `expected_error_type`
      Indicates that this request is expected to return an error of the specified [error type](https://docs.stripe.com/error-codes). When set, the fixture continues executing subsequent requests even if this request returns an error matching the specified type. If the error type does not match, the fixture fails. Common values include `card_error` and `invalid_request_error`.
    - `path`
      Stripe URL path for this request. URL paths can include variables from other fixture queries.
    - `method`
      HTTP method for the request: GET, POST, or DELETE.
    - `params`
      Parameters to include with the request. Accepted values include strings, integers, booleans, nested JSON structures, and fixture queries.

### Flags

- `--override [param]:[path1].[path2]=[value]`
  Override parameters in the fixture. Example: --override plan:product.name=overrideName

- `--add [param]:[path1].[path2]=[value]`
  Add parameters in the fixture. Example: --add customer:name=TestUser

- `--remove [param]:[path1].[path2]`
  Remove parameters from the fixture. Example: --remove customer:description

- `--skip [param]`
  Skip specific steps in the fixture. Example: --skip cus_jenny_rosen

### Examples

**Sample fixture**

```sh
{
  "_meta": {
    "template_version": 0
  },
  "fixtures": [
    {
      "name": "cus_jenny_rosen",
      "path": "/v1/customers",
      "method": "post",
      "params": {
        "name": "Jenny Rosen"
      }
    },
    {
      "name": "pi_jenny_rosen",
      "path": "/v1/payment_intents",
      "method": "post",
      "params": {
        "customer": "${cus_jenny_rosen:id}",
        "amount": 2000,
        "currency": "usd",
        "payment_method": "pm_card_visa",
        "capture_method": "manual",
        "return_url": "https://www.example.com",
        "confirm": true
      }
    },
    {
      "name": "pi_jenny_rosen_capture",
      "path": "/v1/payment_intents/${pi_jenny_rosen:id}/capture",
      "method": "post"
    }
  ]
}
```

**Run fixtures**

```sh
stripe fixtures ./fixtures.json
```

```
Setting up fixture for: cus_jenny_rosen
Setting up fixture for: pi_jenny_rosen
Setting up fixture for: pi_jenny_rosen_capture
```

## Stripe Samples

[Stripe Samples](https://stripe.dev/samples) are complete examples that make it easy to get started with a new Stripe integration. Samples are available for different integration patterns, languages, and frameworks.

The Stripe CLI allows you to download, build, and serve samples to a local directory from your command line.

## samples create

Create a local copy of a sample, choosing which integration pattern and
programming language to use for the client and server. The configuration is
automatically bootstrapped when possible.

**Command:** `stripe samples create`

### Arguments

- `<sample>`
  Name of the sample used to create a local copy.

- `<path>`
  Destination path for the created sample.

### Flags

- `--force-refresh`
  Force a refresh of the cached list of Stripe Samples.

### Examples

**Create a local copy of a sample**

```sh
stripe samples create accept-a-payment
```

**Specify a destination path**

```sh
stripe samples create accept-a-payment ./accept-a-payment-sample
```

## samples list

A list of available [Stripe Samples](https://stripe.dev/samples) that can be
created and bootstrapped by the CLI.

> See the complete list of [Stripe Samples](https://stripe.dev/samples).

**Command:** `stripe samples list`

### Examples

**List available Stripe Samples**

```sh
stripe samples list
```

```
A list of available Stripe Samples:

accept-a-payment
Learn how to accept a payment
Repo: https://github.com/stripe-samples/accept-a-payment

card-brand-choice
Supporting Card Brand Choice with Stripe.
Repo: https://github.com/stripe-samples/card-brand-choice

charging-a-saved-card
Learn how to charge a saved card
Repo: https://github.com/stripe-samples/charging-a-saved-card
...
```

## serve

Start an HTTP server to serve static files. By default, the current working directory will be used.

This command works well alongside [Stripe Samples](https://stripe.dev/samples),
so you can easily serve files from any local copy of a Sample.

**Command:** `stripe serve`

### Arguments

- `<base_path>`
  Path of the directory to serve files from.

### Flags

- `--port <port_number>`
  Port the HTTP server should use.

### Examples

**Basic Usage**

```sh
stripe serve ./sales-tax-sample
```

```
Starting stripe server at address http://localhost:4242
::1 - - [28/Jan/2022:14:00:00 -0800] "GET / HTTP/1.1" 200 175
...
```

## Additional commands

See additional functionality supported by the Stripe CLI.

## terminal quickstart

Use the `terminal quickstart` command to get up and running fast with Stripe Terminal and the Verifone P400 reader.

**Command:** `stripe terminal quickstart`

### Flags

- `--api-key=<api-key>`
  This CLI command only supports using the --api-key flag.

### Examples

**Terminal quickstart**

```sh
stripe terminal quickstart
```

## logout

Use the `logout` command to remove all credentials that connect the CLI to your Stripe account.

By default, credentials will be removed for the default project. Alternatively, you can remove credentials for a specific project or all known projects listed in your configuration file.

> It will take about 24 hours from when you log out for your device's name to stop showing up on the account's dashboard.

**Command:** `stripe logout`

### Flags

- `-a, --all`
  Remove credentials for all projects listed in your configuration.

- `--project-name=<project>`
  Remove the credentials tied to a specific project in your configuration.

### Examples

**Basic logout**

```sh
stripe logout
```

**Log out of a specific project**

```sh
stripe logout --project-name=rocket-rides
```

**Log out of all projects**

```sh
stripe logout --all
```

## feedback

Prints information about how to provide feedback for the Stripe CLI using [GitHub issues](https://github.com/stripe/stripe-cli/issues) and the [CLI feedback form](https://stri.pe/cli-feedback).

**Command:** `stripe feedback`

### Examples

**Basic usage**

```sh
stripe feedback
```

```
We'd love to know what you think of the CLI:

* Report bugs or issues on GitHub:
  https://github.com/stripe/stripe-cli/issues

* Leave us feedback on features you would like to see:
  https://stri.pe/cli-feedback
```

## help

Get help for any command in CLI with `stripe help [path to command]`.

> Every command will also accept the `-h` or `--help` flag to see help for that command.

**Command:** `stripe help`

### Examples

**Basic usage**

```sh
stripe help login
```

```
Login to your Stripe account to setup the CLI

Usage:
  stripe login [flags]

Flags:
  -h, --help          help for login
...
```

## version

Get the version of the Stripe CLI and check if software updates are available.

**Command:** `stripe version`

### Examples

**Basic usage**

```sh
stripe version
```

```
stripe version 1.3.0
A newer version of the Stripe CLI is available.
```

## Further information

See additional information how the Stripe CLI operates.

## Using with Docker

A [Docker image](https://hub.docker.com/r/stripe/stripe-cli) allows you to run the Stripe CLI in a container.

You can set two environment variables that the CLI will use:
- `STRIPE_API_KEY`: the API key to use for the CLI.
- `STRIPE_DEVICE_NAME`: the device name for the CLI, visible in the Dashboard.


Since Docker containers are ephemeral, `stripe-cli login` cannot be used without defining a data volume. You can use the `--api-key` flag instead.

### Example

```title
Running in a docker container
```

## Telemetry

The Stripe CLI includes a telemetry feature that collects usage data to help us improve the developer experience. This feature is **enabled by default**.

## What data is collected

The Stripe CLI collects:
- Command usage patterns (which commands are run, how often)
- Error rates and types to help identify issues
- Performance metrics (command execution times)
- Operating system and CLI version information
- If detected, the name of AI coding agents invoking the CLI (such as Claude Code, Cursor, or Cline)

## What is NOT collected

We do **not** collect:
- API keys or authentication credentials
- Personal information or identifiable data
- File names, paths, or source code
- Command arguments or flag values
- Any data from your Stripe account

## Why we collect this data

Telemetry data helps us:
- Prioritize which features and commands to improve
- Identify and fix bugs more quickly
- Understand how developers use the CLI in different environments
- Optimize performance for common workflows

## How to opt out

To disable telemetry, set the `STRIPE_CLI_TELEMETRY_OPTOUT` environment variable to `1` or `true`:

```bash
# Opt out for a single session
STRIPE_CLI_TELEMETRY_OPTOUT=1 stripe [command]

# Opt out permanently (add to your shell profile)
export STRIPE_CLI_TELEMETRY_OPTOUT=1
```

After opting out, the CLI will not send any telemetry data.

## License

The [Stripe CLI](https://github.com/stripe/stripe-cli) is licensed under the [Apache License 2.0](https://github.com/stripe/stripe-cli/blob/master/LICENSE) and verified on GitHub as being owned by [Stripe](https://github.com/stripe).
