This section details commands related to the Stripe CLI, focusing on debugging, development, and interaction with Stripe services.

## Stripe CLI Commands

The Stripe Command Line Interface (CLI) provides a powerful set of tools for interacting with Stripe services directly from your terminal. This includes functionalities for inspecting API requests, managing webhooks, opening Stripe resources in your browser, and making direct API calls.

### Inspecting API Logs

*   **`stripe logs tail`**: This command establishes a direct connection with Stripe to stream your *test mode* Stripe API request logs in real-time. You can filter these logs using various flags to narrow down the results.

    *   **Filters**:
        *   `--filter-account`: Filter by source and destination account (`connect_in`, `connect_out`, `self`).
        *   `--filter-http-method`: Filter by HTTP method (`GET`, `POST`, `DELETE`).
        *   `--filter-ip-address`: Filter by IP address.
        *   `--filter-request-path`: Filter by exact Stripe path (e.g., `/v1/charges`).
        *   `--filter-request-status`: Filter by request status (`SUCCEEDED`, `FAILED`).
        *   `--filter-source`: Filter by request source (`API`, `DASHBOARD`).
        *   `--filter-status-code`: Filter by HTTP status code.
        *   `--filter-status-code-type`: Filter by HTTP status code type (`2XX`, `4XX`, `5XX`).
    *   **Output Format**:
        *   `--format`: Specify output format (`JSON`).

### Managing Webhooks

*   **`stripe listen`**: This command allows you to receive webhook events from Stripe directly on your local machine. It forwards these events to your application, enabling seamless local testing of webhook functionality.

    *   **Flags**:
        *   `-e, --events`: Specify a comma-separated list of snapshot event types to listen for.
        *   `-f, --forward-to`: The URL to which snapshot webhook events will be forwarded.
        *   `-H, --headers`: A comma-separated list of custom HTTP headers to forward.
        *   `-c, --forward-connect-to`: The URL for forwarding Connect webhook events.
        *   `--connect-headers`: Custom HTTP headers for connected accounts.
        *   `--thin-events`: A comma-separated list of thin event types to listen for.
        *   `--forward-thin-to`: The URL for forwarding thin webhook events.
        *   `--forward-thin-connect-to`: The URL for forwarding thin Connect webhook events.

*   **`stripe trigger`**: Use this command to trigger example webhook events for local testing. These events are based on real Stripe API objects and can simulate various scenarios, including side effects like creating associated API objects.

    *   **Arguments**: A list of supported webhook event types (e.g., `account.application.deauthorized`, `charge.succeeded`).

*   **`stripe events resend`**: Resend a specific event to your local webhook endpoint. This is useful for replaying events that may have been missed or for debugging.

    *   **Arguments**: The ID of the event to resend.
    *   **Flags**:
        *   `--account`: Specify the connected account ID for Connect webhook endpoints.
        *   `-c, --confirm`: Skip the confirmation prompt.
        *   `--dark-style`: Use a dark color scheme.
        *   `-e, --expand`: Expand response attributes inline.
        *   `-i, --idempotency`: Set an idempotency key for the request.
        *   `--live`: Make a live request (default is test mode).
        *   `-s, --show-headers`: Display response HTTP headers.
        *   `--stripe-account`: Specify the Stripe account for the request.
        *   `-v, --stripe-version`: Specify the Stripe API version.
        *   `--webhook-endpoint`: Resend the event to a specific webhook endpoint ID.

### Opening Stripe Resources

*   **`stripe open`**: This command provides a shortcut to open various Stripe documentation pages or your Stripe Dashboard in your browser.

    *   **Arguments**: A shortcut string (e.g., `api`, `dashboard`, `dashboard/webhooks`).
    *   **Flags**:
        *   `--list`: List all supported shortcuts.
        *   `--live`: Open the Dashboard for your live integration (default is test mode).

### Making API Requests

*   **`stripe get`**: Make GET HTTP requests to retrieve individual API objects or sets of objects. The output can be piped to other tools like `jq` for further processing.

    *   **Arguments**: The ID of the API object or the URL path.
    *   **Flags**: Similar to `stripe events resend`, including `--confirm`, `--dark-style`, `--data`, `--ending-before`, `--expand`, `--idempotency`, `--limit`, `--live`, `--show-headers`, `--starting-after`, `--stripe-account`, `--stripe-version`.

*   **`stripe post`**: Make POST HTTP requests to the Stripe API for creating or updating resources. Supports features like idempotency keys and expandable objects.

    *   **Arguments**: The URL path of the API object to create or update.
    *   **Flags**: Similar to `stripe get`, including `--confirm`, `--dark-style`, `--data`, `--expand`, `--idempotency`, `--live`, `--show-headers`, `--stripe-account`, `--stripe-version`.

*   **`stripe delete`**: Make DELETE HTTP requests to remove API objects.

    *   **Arguments**: The URL path of the API object to delete.
    *   **Flags**: Similar to `stripe get`, including `--confirm`, `--dark-style`, `--data`, `--expand`, `--idempotency`, `--live`, `--show-headers`, `--stripe-account`, `--stripe-version`.

### Serving Static Files

*   **`stripe serve`**: Start an HTTP server to serve static files, typically used for local development with Stripe Samples.

    *   **Arguments**: The path of the directory to serve files from.
    *   **Flags**:
        *   `--port`: The port for the HTTP server.