## Stripe CLI Commands

This section details various commands available within the Stripe Command Line Interface (CLI) for interacting with your Stripe integration, managing logs, and handling webhooks.

### Inspecting Stripe Integration and Logs

*   **/cli/intro_stripe.md**: Provides an overview of Stripe CLI commands for inspecting integration details, logs, and service availability.
    *   **`stripe logs tail`**: Connects directly to Stripe to display test mode API request logs in real-time. It supports multiple filters that must all match for a log entry to be shown. Individual filters can accept comma-separated values, where a log entry only needs to match one of the provided values.
        *   **Filters available:**
            *   `--filter-account`: Filters by source and destination account (`connect_in`, `connect_out`, `self`).
            *   `--filter-http-method`: Filters by HTTP method (`GET`, `POST`, `DELETE`).
            *   `--filter-ip-address`: Filters by IP address.
            *   `--filter-request-path`: Filters by exact Stripe path (e.g., `/v1/charges`).
            *   `--filter-request-status`: Filters by request status (`SUCCEEDED`, `FAILED`).
            *   `--filter-source`: Filters by request source (`API`, `DASHBOARD`).
            *   `--filter-status-code`: Filters by HTTP status code.
            *   `--filter-status-code-type`: Filters by HTTP status code type (`2XX`, `4XX`, `5XX`).
        *   **Output Format:** `--format` flag can be used to specify `JSON` output.

### Managing Webhooks

*   **/cli/intro_webhooks.md** and **/cli/listen.md**: Detail commands for listening to webhook events and forwarding them to your application.
    *   **`stripe listen`**: Receives webhook events from Stripe locally via a direct API connection. It can filter events by type, forward events to a specified port, and works with both snapshot and thin events.
        *   **Key Flags:**
            *   `-e, --events`: Comma-separated list of snapshot event types to listen for (default: `[*]`).
            *   `-f, --forward-to`: URL to forward snapshot webhook events to.
            *   `-H, --headers`: Custom HTTP headers to forward.
            *   `-c, --forward-connect-to`: URL to forward Connect webhook events to.
            *   `--connect-headers`: Custom HTTP headers for connected accounts.
            *   `--thin-events`: Comma-separated list of thin event types to listen for.
            *   `--forward-thin-to`: URL to forward thin webhook events to.
            *   `--forward-thin-connect-to`: URL to forward thin Connect webhook events to.
*   **/cli/trigger.md**: Allows you to trigger example webhook events for local testing. These events are based on real API objects and may trigger other related events.
    *   **`stripe trigger`**: Triggers specific webhook events.
        *   **Supported Events (examples):** `account.application.deauthorized`, `account.updated`, `balance.available`, `charge.captured`, `charge.dispute.created`, `charge.failed`, `charge.refunded`, `charge.refund.updated`, `charge.succeeded`, `checkout.session.async_payment_failed`.
*   **/cli/events/resend.md**: Resends a specific event to your CLI's local webhook endpoint.
    *   **`stripe events resend`**: Resends an event.
        *   **Arguments:** The ID of the event to resend.
        *   **Flags:**
            *   `--account=`: For Connect webhook endpoints, specifies the connected account ID.
            *   `-c, --confirm`: Skips the confirmation prompt.
            *   `--dark-style`: Uses a darker color scheme.
            *   `-e, --expand`: Expands response attributes inline.
            *   `-i, --idempotency`: Sets an idempotency key.
            *   `--live`: Makes a live request.
            *   `-s, --show-headers`: Displays response HTTP headers.
            *   `--stripe-account=`: Specifies the Stripe account for the request.
            *   `-v, --stripe-version=`: Specifies the Stripe API version.
            *   `--webhook-endpoint=`: The ID of the webhook endpoint to resend the event to.

### General API Interaction

*   **/cli/get.md**: Makes GET HTTP requests to retrieve individual API objects or sets of objects.
    *   **`stripe get`**: Retrieves API objects.
        *   **Arguments:** API object ID or URL path.
        *   **Flags:** Includes options for confirmation, data, pagination (`ending-before`, `starting-after`), expanding attributes, idempotency keys, limits, live mode, showing headers, specifying Stripe account, and API version.
*   **/cli/post.md**: Makes POST HTTP requests to the Stripe API for creating or updating objects.
    *   **`stripe post`**: Creates or updates API objects.
        *   **Arguments:** URL path of the API object.
        *   **Flags:** Similar to `get`, with added support for sending additional data (`-d`).
*   **/cli/delete.md**: Makes DELETE HTTP requests to the Stripe API.
    *   **`stripe delete`**: Deletes API objects.
        *   **Arguments:** URL path of the API object to delete.
        *   **Flags:** Similar to `post`, with confirmation prompts.

### Utility Commands

*   **/cli/open.md**: Provides shortcuts to open Stripe documentation or the Dashboard in your browser.
    *   **`stripe open`**: Opens specified Stripe resources.
        *   **Arguments:** Shortcuts for various Stripe pages (e.g., `api`, `dashboard`, `dashboard/webhooks`).
        *   **Flags:**
            *   `--list`: Lists all supported shortcuts.
            *   `--live`: Opens the Dashboard in live mode.
*   **/cli/serve.md**: Starts an HTTP server to serve static files, useful for local development with Stripe Samples.
    *   **`stripe serve`**: Serves static files from a specified directory.
        *   **Arguments:** Path to the directory to serve.
        *   **Flags:** `--port` to specify the server port.