# Stripe CLI Documentation

The Stripe CLI is a command-line tool that allows you to interact with Stripe directly from your terminal. It offers a wide range of functionalities for managing your Stripe integration, including inspecting logs, triggering events, and opening Stripe resources in your browser.

## Core Commands

### `stripe logs`

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

#### `stripe 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`: 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`: Filter request logs by HTTP method.
    *   `GET`: HTTP GET requests.
    *   `POST`: HTTP POST requests.
    *   `DELETE`: HTTP DELETE requests.
*   `--filter-ip-address`: Filter request logs by IP address.
*   `--filter-request-path`: Filter request logs that directly match any Stripe path (e.g. `/v1/charges`).
*   `--filter-request-status`: 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`: 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`: Filter request logs by HTTP status code.
*   `--filter-status-code-type`: 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`: Specifies the output format for request logs.
    *   `JSON`: Output logs in JSON format.

**Examples:**

```sh
stripe logs tail
```

### `stripe 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 used to quickly open a page on [stripe.com](https://stripe.com).

**Supported Shortcuts:**

*   `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:**

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

### `stripe 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`: 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`: 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`: A comma-separated list of custom HTTP headers to forward. Ex: `"Key1:Value1, Key2:Value2"`
*   `-c, --forward-connect-to`: 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`: 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`: 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`: 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`:

### `stripe 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:**

*   ``: 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.
    *   `account.updated`: Occurs whenever an account status or property has changed.
    *   `balance.available`: Occurs whenever your Stripe balance has been updated (e.g., when a charge is available to be paid out).
    *   `charge.captured`: Occurs whenever a previously uncaptured charge is captured.
    *   `charge.dispute.created`: Occurs whenever a customer disputes a charge with their bank.
    *   `charge.failed`: Occurs whenever a failed charge attempt occurs.
    *   `charge.refunded`: Occurs whenever a charge is refunded, including partial refunds.
    *   `charge.refund.updated`: Occurs whenever a refund is updated, on selected payment methods.
    *   `charge.succeeded`: Occurs whenever a new charge is created and is successful.
    *   `checkout.session.async_payment_failed`: Occurs

### `stripe 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:**

*   ``: The ID of the event to resend.

**Flags:**

*   `--account=`: 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`: Response attributes to expand inline (target nested values with `nested[param]=value`).
*   `-i, --idempotency`: 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`: Specify the Stripe account to use for this request.
*   `-v, --stripe-version`: Specify the Stripe API version to use for this request.
*   `--webhook-endpoint=`: Resend the event to the given webhook endpoint ID (`we_123456`).

**Examples:**

```sh
stripe events resend evt_1PH9HU2eZvKYlo2CrSrLx8y1
```

### `stripe 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 of the API object to retrieve.
*   ``: 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`: Additional data to send with an API request. Supports setting nested values (e.g `nested[param]=value`).
*   `-b, --ending-before`: Retrieve the previous page in the list. Pagination uses a cursor that depends on the ID of an object in the list.
*   `-e, --expand`: Response attributes to expand inline (target nested values with `nested[param]=value`).
*   `-i, --idempotency`: Set an idempotency key for the request, preventing the same request from replaying within 24 hours.
*   `-l, --limit`: 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`: Retrieve the next page in the list. Pagination uses a cursor that depends on the ID of an object in the list.
*   `--stripe-account`: Specify the Stripe account to use for this request.
*   `-v, --stripe-version`: Specify the Stripe API version to use for this request.

**Examples:**

```sh
stripe get ch_1OKcnt2eZvKYlo2C99k9lfXl
```

### `stripe 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:**

*   ``: 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`: Additional data to send with an API request. Supports setting nested values (e.g `nested[param]=value`).
*   `-e, --expand`: Response attributes to expand inline (target nested values with `nested[param]=value`).
*   `-i, --idempotency`: 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`: Specify the Stripe account to use for this request.
*   `-v, --stripe-version`: Specify the Stripe API version to use for this request.

**Examples:**

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

### `stripe 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:**

*   ``: 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`: Additional data to send with an API request. Supports setting nested values (e.g `nested[param]=value`).
*   `-e, --expand`: Response attributes to expand inline (target nested values with `nested[param]=value`).
*   `-i, --idempotency`: 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`: Specify the Stripe account to use for this request.
*   `-v, --stripe-version`: Specify the Stripe API version to use for this request.

**Examples:**

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

### `stripe 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:**

*   ``: Path of the directory to serve files from.

**Flags:**

*   `--port`: Port the HTTP server should use.

**Examples:**

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