## Stripe CLI Documentation

This documentation covers the Stripe Command Line Interface (CLI), a powerful tool for developers to interact with Stripe services directly from their terminal.

### Getting Started

*   **Installation:** Follow the [installation guide](https://docs.stripe.com/stripe-cli.md#install) to set up the Stripe CLI on your system.
*   **Login:** Connect the CLI to your Stripe account using the `stripe login` command. This command persists your secret key locally and can be configured globally or for specific projects.
    *   `stripe login`
    *   `stripe login --project-name=<project-name>`
    *   `stripe login --interactive` (for manual API key entry)
*   **API Keys:** Understand how the Stripe CLI handles API keys, including `stripe login`, `stripe config`, the `--api-key` flag, and environment variables (`STRIPE_API_KEY`, `STRIPE_DEVICE_NAME`).

### Core Functionality

*   **Reference:** The Stripe CLI reference documents every command and flag available, enabling you to build, test, and manage your Stripe integration.
*   **API Objects:** Create, retrieve, update, and delete API objects directly from the terminal.
    *   `stripe {resource command}` (e.g., `stripe customers create`)
*   **Webhooks:** Securely test webhooks without relying on third-party tunneling software using the `stripe listen` command.
*   **API Request Logs:** Tail API request logs in real time with `stripe logs tail`.

### Configuration and Management

*   **`stripe config`:** Manually set and manage CLI configuration options, including editing the configuration file, listing options, setting values, and unsetting options.
    *   `stripe config --set <option>=<value>`
    *   `stripe config --unset <option>`
    *   `stripe config --list`
    *   `stripe config --edit`
*   **Global Flags:** Utilize global flags that apply to all commands, such as `--api-key`, `--color`, `--config`, `--device-name`, `--help` (`-h`), `--log-level`, `--project-name` (`-p`), and `--version` (`-v`).
*   **Logout:** Remove credentials that connect the CLI to your Stripe account using `stripe logout`. This can be done for the default project, a specific project, or all projects.
    *   `stripe logout`
    *   `stripe logout --project-name=<project-name>`
    *   `stripe logout --all`

### Advanced Features

*   **Stripe Samples:** Download, build, and serve sample Stripe integrations.
    *   `stripe samples create <sample-name> [destination-path]`
    *   `stripe samples list`
*   **`stripe serve`:** Start an HTTP server to serve static files, useful for working with Stripe Samples.
*   **Fixtures:** Use JSON files to issue a series of API requests for generating sample data, executing flows, or testing API behavior.
*   **Resources & HTTP Commands:** Interact with Stripe API resources using resource commands or convenient HTTP command shorthands.
*   **Terminal Quickstart:** Get started quickly with Stripe Terminal and the Verifone P400 reader using `stripe terminal quickstart`.

### Additional Information

*   **Docker:** Run the Stripe CLI in a Docker container. Note that `stripe-cli login` requires a data volume, and the `--api-key` flag is an alternative.
*   **Telemetry:** The Stripe CLI collects usage data to improve the developer experience. You can opt out by setting the `STRIPE_CLI_TELEMETRY_OPTOUT` environment variable.
*   **License:** The Stripe CLI is licensed under the Apache License 2.0.
*   **Feedback:** Provide feedback on the Stripe CLI via [GitHub issues](https://github.com/stripe/stripe-cli/issues) or the [CLI feedback form](https://stri.pe/cli-feedback).
*   **Help:** Get help for any command using `stripe help <command>` or the `-h`/`--help` flags.
*   **Version:** Check the Stripe CLI version and for available updates with `stripe version`.
*   **Autocompletion:** Set up shell autocompletion for Bash and ZSH to make using the CLI easier.