### Install Plugin with Runtime Requirements Source: https://github.com/stripe/stripe-cli/blob/master/pkg/plugins/RUNTIME.md Example output when installing a plugin that triggers an automatic Node.js runtime download. ```bash $ stripe plugin install generate downloading Node.js v20.18.1 runtime... installing 'generate' v1.0.0... ✔ installation of v1.0.0 complete. ``` -------------------------------- ### Setup Dependencies Source: https://github.com/stripe/stripe-cli/wiki/Developing-the-Stripe-CLI Run this command after installation to set up all necessary project dependencies. ```sh make setup ``` -------------------------------- ### Run Test Suite Source: https://github.com/stripe/stripe-cli/wiki/Developing-the-Stripe-CLI Execute this command to run the test suite and verify the installation and setup. ```sh make test ``` -------------------------------- ### Install Stripe CLI on Windows via Scoop Source: https://github.com/stripe/stripe-cli/wiki/Installation Use Scoop to add the Stripe bucket and install the CLI on Windows. ```sh $ scoop bucket add stripe https://github.com/stripe/scoop-stripe-cli.git ``` ```sh $ scoop install stripe ``` -------------------------------- ### Run Linter Source: https://github.com/stripe/stripe-cli/wiki/Developing-the-Stripe-CLI To run the linter, execute 'make lint'. Ensure golangci-lint is installed separately. ```sh make lint ``` -------------------------------- ### Install Stripe CLI (Go 1.16-1.17) Source: https://github.com/stripe/stripe-cli/wiki/Developing-the-Stripe-CLI For Go versions 1.16 or 1.17, use this command to get and update the Stripe CLI dependencies. You will then need to change into the specific directory. ```sh go get -v -u github.com/stripe/stripe-cli/... cd go/src/github.com/stripe/stripe-cli ``` -------------------------------- ### Install Stripe CLI (Go 1.18+) Source: https://github.com/stripe/stripe-cli/wiki/Developing-the-Stripe-CLI Use these commands for Go versions 1.18.x or greater. Ensure you clone the repository and navigate into the directory before running. ```sh git clone https://github.com/stripe/stripe-cli cd stripe-cli go get ./... ``` -------------------------------- ### Stripe CLI API Test Example Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Example of an API test function that requires an API key and uses sanitized logging for output. Ensure STRIPE_API_KEY is set. ```go func TestAPINewFeature(t *testing.T) { runner := getRunner(t) requireAPIKey(t) runner = runner.WithEnv(map[string]string{ "STRIPE_API_KEY": testutil.GetAPIKey(), }) result, err := runner.Run("api-command") // Use sanitized logging for output that may contain secrets logSanitizedf(t, "Result: %s", result.Stdout) } ``` -------------------------------- ### Install Stripe CLI on Debian/Ubuntu Source: https://github.com/stripe/stripe-cli/wiki/Installation Commands to add the repository and install the CLI on Debian or Ubuntu-based distributions. ```sh $ sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 379CE192D401AB61 ``` ```sh $ echo "deb https://dl.bintray.com/stripe/stripe-cli-deb stable main" | sudo tee -a /etc/apt/sources.list ``` ```sh $ sudo apt-get update ``` ```sh $ sudo apt-get install stripe ``` -------------------------------- ### Create a charge via CLI Source: https://github.com/stripe/stripe-cli/wiki/Resource-commands Example of creating a charge resource using the Stripe CLI. ```sh $ stripe charges create --amount=100 --currency=usd --source=tok_visa ``` -------------------------------- ### Serve static files with Stripe CLI Source: https://github.com/stripe/stripe-cli/wiki/Serve-command Starts a local HTTP server to serve files from the current directory or a specified path. ```sh $ stripe serve ``` ```sh $ stripe serve /path/to/directory ``` -------------------------------- ### Install Stripe CLI on macOS via Homebrew Source: https://github.com/stripe/stripe-cli/wiki/Installation Use Homebrew to install the Stripe CLI on macOS systems. ```sh $ brew install stripe/stripe-cli/stripe ``` -------------------------------- ### Fixture Query Syntax Source: https://github.com/stripe/stripe-cli/wiki/Fixtures-command These examples demonstrate how to reference data from previous API responses or environment variables within fixture definitions. Use `${name:json_path}` for response attributes and `${.env:VARIABLE_NAME}` for environment variables. ```text Accessing attributes in responses: ${name:json_path} Accessing environment variables: ${.env:VARIABLE_NAME} ``` -------------------------------- ### View Runtime Directory Structure Source: https://github.com/stripe/stripe-cli/blob/master/pkg/plugins/RUNTIME.md The file system layout for installed plugins and shared Node.js runtimes. ```text ~/.config/stripe/ ├── plugins/ │ └── generate/ │ └── 1.0.0/ │ └── stripe-cli-generate └── runtimes/ └── node/ └── 20.18.1/ └── bin/ └── node ``` -------------------------------- ### Install Stripe CLI on RedHat/CentOS Source: https://github.com/stripe/stripe-cli/wiki/Installation Commands to add the yum repository and install the CLI on RedHat or CentOS-based distributions. ```sh $ wget https://bintray.com/stripe/stripe-cli-rpm/rpm -O bintray-stripe-stripe-cli-rpm.repo && sudo mv bintray-stripe-stripe-cli-rpm.repo /etc/yum.repos.d/ ``` ```sh $ sudo yum update ``` ```sh $ sudo yum install stripe ``` -------------------------------- ### Install Stripe CLI via npm Source: https://github.com/stripe/stripe-cli/blob/master/README.md Install the Stripe CLI globally using npm. Requires Node.js version 18 or higher. ```sh npm install -g @stripe/cli ``` -------------------------------- ### Tail all test mode Stripe API logs Source: https://github.com/stripe/stripe-cli/wiki/Logs-tail-command Run this command to establish a direct connection with Stripe and start tailing all test mode API request logs in your terminal. ```sh $ stripe logs tail ``` -------------------------------- ### Stripe CLI Offline Test Example Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Example of an offline test function for a new command. It checks for successful execution and a zero exit code. ```go func TestOfflineNewFeature(t *testing.T) { runner := getRunner(t) result, err := runner.Run("new-command", "--flag") if err != nil { fatalf(t, "Failed to run command: %v", err) } if result.ExitCode != 0 { errorf(t, "Expected exit code 0, got %d", result.ExitCode) } } ``` -------------------------------- ### Tail Stripe logs with multiple values for a single filter Source: https://github.com/stripe/stripe-cli/wiki/Logs-tail-command Specify multiple values for a single filter using a comma-separated list. A log only needs to match one of the provided values. This example filters for GET or POST requests. ```sh $ stripe logs tail --filter-http-method GET,POST ``` -------------------------------- ### Test Raw GET to V2 Path Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests making a raw GET request to a V2 path, such as `stripe get /v2/core/events`. ```bash stripe get /v2/core/events ``` -------------------------------- ### Stripe CLI Search Command Source: https://github.com/stripe/stripe-cli/blob/master/pkg/docs/markdown/testdata/showcase.md Example of using the Stripe CLI to search for documentation related to 'payment intents'. This command is useful for quickly finding relevant Stripe API information. ```sh stripe docs search "payment intents" ``` -------------------------------- ### Verify API Authentication Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that API authentication works correctly by fetching the balance using `stripe get /v1/balance`. ```bash stripe get /v1/balance ``` -------------------------------- ### Retrieve a Stripe charge Source: https://github.com/stripe/stripe-cli/wiki/HTTP-(get,-post-&-delete)-commands Use the get command to fetch details for a specific charge ID. ```sh $ stripe get /charges/ch_123 ``` -------------------------------- ### Example Fixture JSON Structure Source: https://github.com/stripe/stripe-cli/wiki/Fixtures-command This JSON structure defines a series of Stripe API requests to be executed by the Stripe CLI. It includes metadata, a list of fixtures, and details for each request such as name, path, method, and parameters. ```json { "_meta": { "template_version": 0 }, "fixtures": [ { "name": "cust_bender", "path": "/v1/customers", "method": "post", "params": { "name": "Bender Bending Rodriguez", "email": "bender@planex.com", "phone": "${.env:PHONE}", "source": "tok_amex", "address": { "line1": "1 Planet Express St", "city": "New New York" } } }, { "name": "char_bender", "path": "/v1/charges", "method": "post", "params": { "customer": "${cust_bender:id}", "amount": 100, "currency": "usd", "capture": false } }, { "name": "capt_bender", "path": "/v1/charges/${char_bender:id}/capture", "method": "post" } ] } ``` -------------------------------- ### Tail Stripe logs with multiple filters Source: https://github.com/stripe/stripe-cli/wiki/Logs-tail-command Use multiple filters to refine the logs displayed. A log must match all specified filters to be shown. This example filters for POST requests with a 4XX status code. ```sh $ stripe logs tail --filter-http-method POST --filter-status-code-type 4XX ``` -------------------------------- ### Dockerfile for custom Stripe CLI image Source: https://github.com/stripe/stripe-cli/blob/master/README.md A Dockerfile to build a custom Stripe CLI image. It uses an official Stripe CLI image, installs `pass` and `gpg-agent`, and copies a custom entrypoint script. ```dockerfile FROM stripe/stripe-cli:vx.x.x RUN apk add pass gpg-agent COPY ./entrypoint.sh /entrypoint.sh ENTRYPOINT [ "/entrypoint.sh" ] ``` -------------------------------- ### Stripe CLI HTTP Commands Overview Source: https://github.com/stripe/stripe-cli/wiki/HTTP-(get,-post-&-delete)-commands The Stripe CLI offers commands to interact with the Stripe API in test mode, supporting GET, POST, and DELETE requests. These commands simplify API interactions by abstracting away the need for explicit headers and providing convenient flags for common API features. ```APIDOC ## Stripe CLI HTTP Commands ### Description The Stripe CLI allows you to make `GET`, `POST`, and `DELETE` requests to the Stripe API in test mode. These commands simplify API interactions by handling common tasks and providing access to many Stripe API features through command-line flags. ### Key Commands - `stripe get `: Retrieves data from the specified endpoint. - `stripe post `: Sends data to the specified endpoint to create or update a resource. - `stripe delete `: Deletes a resource at the specified endpoint. ### Usage Examples **Retrieve a specific charge:** ```sh $ stripe get /charges/ch_123 ``` **Create a charge with data:** ```sh $ stripe post /charges -d amount=100 -d source=tok_visa -d currency=usd ``` **List past due subscriptions and cancel them:** ```sh $ stripe get /subscriptions -d status=past_due | jq ".data[].id" | xargs -I % -p stripe delete /subscriptions/% ``` ### Advanced Options The `get`, `post`, and `delete` commands support various flags to control request behavior and customize responses. These flags map to common Stripe API features. #### Common Flags for `get`, `post`, `delete`: - `-d`, `--data `: Data to pass for the API request. Can be used multiple times for multiple key-value pairs. - `-e`, `--expand `: Response attributes to expand inline. See Stripe API documentation for supported objects. - `-i`, `--idempotency `: Sets the idempotency key for your request. - `-v`, `--api-version `: Set the Stripe API version to use for your request. - `--stripe-account `: Set a header identifying the connected account for which the request is being made. - `-s`, `--show-headers`: Show headers on responses. #### Specific Flags: - `delete` command: - `-c`, `--confirm`: Automatically confirm the command, bypassing prompts. - `get` command: - `-l`, `--limit `: A limit on the number of objects to be returned (between 1 and 100). - `-a`, `--starting-after `: Retrieve the next page in the list using a cursor. - `-b`, `--ending-before `: Retrieve the previous page in the list using a cursor. ### Request Body Example (for POST requests) ```json { "amount": 100, "source": "tok_visa", "currency": "usd" } ``` ### Response Example (for GET requests) ```json { "id": "ch_123", "object": "charge", "amount": 100, "currency": "usd", "status": "succeeded" } ``` ``` -------------------------------- ### Update Stripe CLI via package managers Source: https://github.com/stripe/stripe-cli/wiki/Installing-and-updating Commands to update the Stripe CLI installation using common system package managers. ```shell brew upgrade stripe ``` ```shell apt-get upgrade stripe ``` ```shell yum upgrade stripe ``` ```shell scoop update ``` -------------------------------- ### Access resource help documentation Source: https://github.com/stripe/stripe-cli/wiki/Resource-commands Use the --help flag on any resource to view available actions and command options. ```sh $ stripe charges --help ``` -------------------------------- ### Create a new Stripe sample Source: https://github.com/stripe/stripe-cli/wiki/Samples-command Initializes a selected sample project locally, including automatic configuration of API keys and webhook secrets. ```sh $ stripe samples create ``` -------------------------------- ### List supported Stripe samples Source: https://github.com/stripe/stripe-cli/wiki/Samples-command Displays all available sample integrations compatible with the current CLI version. ```sh $ stripe samples list ``` -------------------------------- ### Initialize Palette with Commands Source: https://github.com/stripe/stripe-cli/blob/master/pkg/docs/palette/README.md Initializes a new palette component with a predefined list of commands. This snippet demonstrates setting up a basic mode for fuzzy filtering. ```go import "github.com/stripe/stripe-cli/pkg/docs/internal/palette" var commands = []palette.Item{ palette.Command{Name: "Open file"}, palette.Command{Name: "Save"}, palette.Command{Name: "Quit"}, } mode := palette.Mode{ Name: "commands", Items: func(_ palette.Model, q string) []palette.Item { return palette.FilterFuzzy(commands, q) }, } p := palette.New(palette.WithModes(mode)) ``` -------------------------------- ### List configuration values Source: https://github.com/stripe/stripe-cli/wiki/Config-command Displays all current configuration settings using the --list flag. ```sh $ stripe config --list ``` -------------------------------- ### Configure project-specific settings Source: https://github.com/stripe/stripe-cli/wiki/Login-command Initializes a configuration specific to a project using the --project-name flag. ```sh $ stripe login --project-name=rocket-rides ``` -------------------------------- ### Build Stripe CLI from source Source: https://github.com/stripe/stripe-cli/wiki/Installing-and-updating Use the Go toolchain to fetch and compile the Stripe CLI source code. ```shell go get -u github.com/stripe/stripe-cli/... ``` -------------------------------- ### Go Main Function Source: https://github.com/stripe/stripe-cli/blob/master/pkg/docs/markdown/testdata/showcase.md A basic Go program that prints 'Hello, world!' to the console. This is a standard entry point for Go applications. ```go package main import "fmt" func main() { fmt.Println("Hello, world!") } ``` -------------------------------- ### Verify Listen Command Help Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that the help message for the `stripe listen` command is displayed correctly. ```bash stripe listen --help ``` -------------------------------- ### Verify Login Command Help Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that the help message for the `stripe login` command is displayed correctly. ```bash stripe login --help ``` -------------------------------- ### Edit configuration file Source: https://github.com/stripe/stripe-cli/wiki/Config-command Opens the configuration file in the default system editor. ```sh $ stripe config -e ``` -------------------------------- ### Load resource by ID shortcut Source: https://github.com/stripe/stripe-cli/wiki/HTTP-(get,-post-&-delete)-commands The CLI automatically resolves requests when an ID is provided directly without a path prefix. ```sh $ stripe get ch_1EOA8IByst5pquEteSXgXjj0 { "id": "ch_1EOA8IByst5pquEteSXgXjj0", "object": "charge", "amount": 1099, "amount_refunded": 0, ... } ``` -------------------------------- ### Configure CLI interactively Source: https://github.com/stripe/stripe-cli/wiki/Login-command Manually provides an API key during the login process using the --interactive flag. ```sh $ stripe login --interactive Enter your API key: sk_test_foobar Your API key is: sk_test_**obar How would you like to identify this device in the Stripe Dashboard? [default: st-tomer1] You're configured and all set to get started ``` -------------------------------- ### Verify Core Commands Listing Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that the `stripe --help` command lists the core commands available in the CLI. ```bash stripe --help ``` -------------------------------- ### Stripe CLI Basic Usage Source: https://github.com/stripe/stripe-cli/blob/master/README.md Shows the basic structure for invoking Stripe CLI commands and how to access help information. ```sh stripe [command] # Run `--help` for detailed information about CLI commands stripe [command] help ``` -------------------------------- ### Build the Stripe CLI Binary Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Build the CLI binary before running tests. This is a prerequisite for setting the binary path. ```bash make build ``` -------------------------------- ### Run All Canary Tests Directly Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Run all canary tests directly using the go test command. Ensure STRIPE_CLI_BINARY and STRIPE_API_KEY are set. A timeout is recommended for API tests. ```bash STRIPE_CLI_BINARY=$(pwd)/stripe STRIPE_API_KEY=sk_test_... go test -v -timeout 15m ./canary/... ``` -------------------------------- ### Test Resource Creation Command Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests the functionality of resource creation commands, such as `stripe products create`. ```bash stripe products create ``` -------------------------------- ### Open Stripe Documentation or Dashboard Pages Source: https://github.com/stripe/stripe-cli/wiki/Open-command Use the 'open' command with a shortcut to quickly access Stripe's website or dashboard. For dashboard pages, add the '--live' flag to open in live mode. ```sh $ stripe open ``` ```sh $ stripe open dashboard/apikeys --live ``` -------------------------------- ### Build Stripe CLI Binary and Set Environment Variable Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Builds the Stripe CLI binary using make and exports the path to the STRIPE_CLI_BINARY environment variable. ```bash make build export STRIPE_CLI_BINARY=$(pwd)/stripe ``` -------------------------------- ### Create a Charge with Stripe CLI Source: https://github.com/stripe/stripe-cli/wiki/resources:-available-commands Use this command to create a new charge. Specify the amount, currency, and source. ```bash $ stripe charges create amount=100 currency=usd source=tok_visa ``` -------------------------------- ### Stripe CLI Docker entrypoint script Source: https://github.com/stripe/stripe-cli/blob/master/README.md A shell script to be used as the entrypoint for a custom Stripe CLI Docker image. It initializes GPG keys and a password store if they don't exist, and prepares options for live mode requests. ```sh #!/bin/sh if ! [ -f ~/.gnupg/trustdb.gpg ] ; then chmod 700 ~/.gnupg/ gpg --quick-generate-key stripe-live # This will generate a gpg key called "stripe-live" fi if ! [ -f ~/.password-store/.gpg-id ] ; then pass init stripe-live # This will initialize a password store record named "stripe-live", using the gpg key above pass insert stripe-live # This will insert value for the password store "stripe-live", which we will put Stripe Live Secret Key in fi string="$@" liveflag="--live" if [ -z "${string##*$liveflag*}" ] ;then OPTS="--api-key $(pass show stripe-live)" # This will use the content of the password store "stripe-live" which was inserted in line 8 fi #pass insert stripe-live /bin/stripe $@ $OPTS ``` -------------------------------- ### Run custom Stripe CLI Docker image Source: https://github.com/stripe/stripe-cli/blob/master/README.md Run the custom `stripe-cli` Docker image, mounting necessary volumes for configuration, GPG, and password store. Replace `$command` with the desired Stripe CLI command. ```sh docker run --rm -it -v stripe-config://root/.config/stripe/ -v stripe-gpg://root/.gnupg/ -v stripe-pass://root/.password-store/ stripe-cli $command ``` -------------------------------- ### Run Plugin Runtime Tests Source: https://github.com/stripe/stripe-cli/blob/master/pkg/plugins/RUNTIME.md Execute the test suite for runtime-related functionality. ```bash go test ./pkg/plugins/... -v ``` -------------------------------- ### Create a resource with POST data Source: https://github.com/stripe/stripe-cli/wiki/HTTP-(get,-post-&-delete)-commands Use the -d flag to pass data parameters to a POST request. ```sh $ stripe post /charges -d amount=100 -d source=tok_visa -d currency=usd ``` -------------------------------- ### Build and Test Commands Source: https://github.com/stripe/stripe-cli/blob/master/CLAUDE.md Common make targets for building, testing, formatting, and linting the Stripe CLI project. These commands streamline development workflows. ```bash make build # Build binary (runs go generate first) make test # Run tests with race detector and coverage make lint # Run golangci-lint v2 make fmt # Format with gofmt + goimports make ci # Full CI: build-all-platforms + test + go-mod-tidy + protoc-ci make protoc # Regenerate all protobuf code make setup # Download Go modules ``` ```bash go build ./... go vet ./... ``` -------------------------------- ### Run All Canary Tests (Requires API Key) Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Execute all canary tests, including those that interact with the Stripe API. An API key must be set. ```bash export STRIPE_API_KEY=sk_test_... make canary ``` -------------------------------- ### Run Stripe CLI with Docker Source: https://github.com/stripe/stripe-cli/wiki/Installation Execute the Stripe CLI using the official Docker image. ```sh $ docker run --rm -it stripe/stripe-cli version stripe version x.y.z (beta) ``` -------------------------------- ### Verify Binary Version Output Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that the `stripe version` command runs and outputs the binary version. ```bash stripe version ``` -------------------------------- ### Test Fixture Functionality Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that fixtures work as expected by triggering a `customer.created` event using `stripe trigger customer.created`. ```bash stripe trigger customer.created ``` -------------------------------- ### Test Generated Customer List Command Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that generated commands like `stripe customers list` function correctly. ```bash stripe customers list ``` -------------------------------- ### Verify Config List Functionality Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that the `stripe config --list` command correctly displays the current configuration. ```bash stripe config --list ``` -------------------------------- ### Test Listen Output Format Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that the `stripe listen --format JSON` command displays events correctly in JSON format when triggered. ```bash stripe listen --format JSON ``` -------------------------------- ### List available Stripe resources Source: https://github.com/stripe/stripe-cli/wiki/Resource-commands A comprehensive list of all Stripe API resources supported by the CLI. ```text 3d_secure account_links accounts apple_pay_domains application_fees balance balance_transactions bank_accounts capabilities cards charges checkout country_specs coupons credit_notes customer_balance_transactions customers disputes ephemeral_keys events exchange_rates external_accounts fee_refunds file_links files invoiceitems invoices issuing line_items login_links order_returns orders payment_intents payment_methods payment_sources payouts persons plans products radar refunds reporting reviews scheduled_query_runs setup_intents skus sources subscription_items subscription_schedules subscriptions tax_ids tax_rates terminal tokens topups transfer_reversals transfers usage_records webhook_endpoints ``` -------------------------------- ### Verify Logs Tail Command Help Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that the help message for the `stripe logs tail` command is displayed correctly. ```bash stripe logs tail --help ``` -------------------------------- ### Release New Version Source: https://github.com/stripe/stripe-cli/wiki/Developing-the-Stripe-CLI To release a new version, checkout the 'master' branch and run 'make release'. The command will prompt for a version number and then push a new tag. ```sh make release ``` -------------------------------- ### Trigger a webhook event Source: https://github.com/stripe/stripe-cli/wiki/Trigger-command Use this command to initiate a specific webhook event in your local environment. ```sh $ stripe trigger ``` -------------------------------- ### Test Multi-Profile Support Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies support for multiple Stripe CLI profiles using the `--project-name` flag. ```bash --project-name flag ``` -------------------------------- ### List supported webhook events Source: https://github.com/stripe/stripe-cli/wiki/Trigger-command A list of currently supported webhook events that can be triggered via the CLI. ```text balance.available charge.captured charge.dispute.created charge.failed charge.refunded charge.succeeded checkout.session.async_payment_failed (NOTE: needs to be run with a UK Stripe account) checkout.session.async_payment_succeeded (NOTE: needs to be run with a UK Stripe account) checkout.session.completed customer.created customer.deleted customer.source.created customer.source.updated customer.subscription.created customer.subscription.deleted customer.subscription.updated customer.updated invoice.created invoice.finalized invoice.payment_failed invoice.payment_succeeded invoice.updated issuing_authorization.request issuing_card.created issuing_cardholder.created payment_intent.amount_capturable_updated payment_intent.canceled payment_intent.created payment_intent.payment_failed payment_intent.succeeded payment_method.attached plan.created plan.deleted plan.updated product.created product.deleted product.updated setup_intent.canceled setup_intent.created setup_intent.setup_failed setup_intent.succeeded subscription_schedule.canceled subscription_schedule.created subscription_schedule.released subscription_schedule.updated ``` -------------------------------- ### List Available Top-Level Commands in Stripe CLI Source: https://github.com/stripe/stripe-cli/wiki/resources:-available-commands This list displays all the top-level commands available in the Stripe CLI for interacting with different API resources. ```bash 3d_secure account_links accounts apple_pay_domains application_fees balance balance_transactions bank_accounts bitcoin_receivers bitcoin_transactions capabilities cards charges checkout country_specs coupons credit_notes customer_balance_transactions customers disputes ephemeral_keys events exchange_rates external_accounts fee_refunds file_links files invoiceitems invoices issuer_fraud_records issuing line_items login_links order_returns orders payment_intents payment_methods payment_sources payouts persons plans products radar recipients refunds reporting reviews scheduled_query_runs setup_intents skus sources subscription_items subscription_schedules subscriptions tax_ids tax_rates terminal tokens topups transfer_reversals transfers usage_records webhook_endpoints ``` -------------------------------- ### Configure Plugin Runtime in plugins.toml Source: https://github.com/stripe/stripe-cli/blob/master/pkg/plugins/RUNTIME.md Specify the required Node.js version within the plugin manifest file. ```toml [[Plugin.Release]] Arch = "amd64" OS = "darwin" Version = "1.0.0" Sum = "abc123..." Runtime = {node = "20"} # Requires Node.js 20.x LTS ``` -------------------------------- ### Generate Zsh Completion Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests the generation of zsh completion scripts using `stripe completion --shell zsh`. ```bash stripe completion --shell zsh ``` -------------------------------- ### Set configuration value Source: https://github.com/stripe/stripe-cli/wiki/Config-command Sets a specific configuration key to a provided value. ```sh $ stripe config ``` -------------------------------- ### Test V2 Core Events List Command Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that V2 resource commands, such as `stripe v2 core events list`, function correctly. ```bash stripe v2 core events list ``` -------------------------------- ### Build custom Stripe CLI Docker image Source: https://github.com/stripe/stripe-cli/blob/master/README.md Build a Docker image named `stripe-cli` using the `Dockerfile-cli`. ```sh docker build -t stripe-cli -f Dockerfile-cli . ``` -------------------------------- ### Test V2 Event Destinations List Command Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that V2 namespace routing works correctly for commands like `stripe v2 core event_destinations list`. ```bash stripe v2 core event_destinations list ``` -------------------------------- ### Test API Write Operations Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that write operations like creating and deleting customers work correctly using `stripe post/delete /v1/customers`. ```bash stripe post/delete /v1/customers ``` -------------------------------- ### Run Stripe CLI in Docker Source: https://github.com/stripe/stripe-cli/wiki/Using-with-Docker Use the --api-key flag to authenticate when running the CLI in a container, as interactive login is not supported. ```sh docker run --rm -it stripe/stripe-cli --api-key my-secret-stripe-key listen --forward-to=localhost:5000/hooks ``` -------------------------------- ### Run Offline Canary Tests Directly Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Alternatively, run offline canary tests directly using the go test command. Ensure the STRIPE_CLI_BINARY is set. ```bash STRIPE_CLI_BINARY=$(pwd)/stripe go test -v ./canary/... -run "TestOffline" ``` -------------------------------- ### Configure Stripe CLI globally Source: https://github.com/stripe/stripe-cli/wiki/Login-command Authenticates the CLI globally by redirecting to the Stripe dashboard. ```sh $ stripe login ``` -------------------------------- ### Test Log Streaming Connection Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that the `stripe logs tail` command successfully connects to stream logs. ```bash stripe logs tail ``` -------------------------------- ### Set Stripe Test API Key Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Sets the STRIPE_API_KEY environment variable for testing purposes. Replace 'sk_test_your_key_here' with your actual test key. ```bash export STRIPE_API_KEY=sk_test_your_key_here ``` -------------------------------- ### Generate Bash Completion Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests the generation of bash completion scripts using `stripe completion --shell bash`. ```bash stripe completion --shell bash ``` -------------------------------- ### Test Webhook Forwarding End-to-End Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies end-to-end webhook forwarding functionality using `stripe listen --forward-to` and triggering an event. ```bash stripe listen --forward-to ``` -------------------------------- ### GitHub CLI Host Configuration Source: https://github.com/stripe/stripe-cli/blob/master/CLAUDE.md Ensures `gh` commands target the public GitHub. Run `direnv allow` if `GH_HOST` is not set to `github.com`. ```bash GH_HOST=github.com gh pr create ... GH_HOST=github.com gh pr view ... ``` -------------------------------- ### Test Unknown Command Error Handling Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that the CLI handles unknown commands gracefully with an appropriate error message. ```bash stripe nonexistent ``` -------------------------------- ### Add ZSH fpath configuration Source: https://github.com/stripe/stripe-cli/wiki/Completion-command Add the directory containing the completion script to the ZSH fpath variable in your .zshrc file. ```bash fpath=("~/.stripe" $fpath) ``` -------------------------------- ### Load webhook endpoints from API Source: https://github.com/stripe/stripe-cli/wiki/Listen-command Automatically configures the CLI to listen for events defined in the Stripe Dashboard test mode. ```sh $ stripe listen --load-from-webhooks-api --forward-to https://example.com/hooks ``` -------------------------------- ### Forward connect events Source: https://github.com/stripe/stripe-cli/wiki/Listen-command Routes standard webhooks and Connect-specific webhooks to separate local endpoints. ```sh $ stripe listen --forward-to localhost:3000/webhook --forward-connect-to localhost:3000/connect_webhook ``` -------------------------------- ### Run Stripe CLI version with Docker Source: https://github.com/stripe/stripe-cli/blob/master/README.md Execute the `version` command of the Stripe CLI using its Docker image. The `--rm` flag removes the container after execution. ```sh docker run --rm -it stripe/stripe-cli version ``` -------------------------------- ### Perform Stripe API requests via CLI Source: https://github.com/stripe/stripe-cli/wiki/Resource-commands Use these commands to retrieve, create, or update Stripe resources directly from the terminal. ```sh $ stripe charges retrieve ch_123 $ stripe charges create --amount=100 --currency=usd --source=tok_visa $ stripe charges update ch_123 -d "metadata[key]=value" ``` -------------------------------- ### Login with Stripe CLI via npx Source: https://github.com/stripe/stripe-cli/blob/master/README.md Execute the Stripe CLI login command using npx. This method does not add `stripe` to your system's PATH. ```sh npx @stripe/cli login ``` -------------------------------- ### Test V2 Trigger Fixtures Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that V2 trigger fixtures execute correctly, such as `stripe trigger v1.billing.meter.no_meter_found`. ```bash stripe trigger v1.billing.meter.no_meter_found ``` -------------------------------- ### Test Raw POST to V2 Path with JSON Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests making a raw POST request to a V2 path with JSON content-type, like `stripe post /v2/billing/meter_event_session`. ```bash stripe post /v2/billing/meter_event_session ``` -------------------------------- ### Test V2 POST with JSON Body Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that V2 POST requests with a JSON body, like `stripe v2 billing meter_event_sessions create`, are handled correctly. ```bash stripe v2 billing meter_event_sessions create ``` -------------------------------- ### Version Injection for Builds Source: https://github.com/stripe/stripe-cli/blob/master/CLAUDE.md GoReleaser sets the version at build time using ldflags. The default value is 'master' for development builds. ```bash -ldflags "-s -w -X github.com/stripe/stripe-cli/pkg/version.Version={{.Version}}" ``` -------------------------------- ### Pipe CLI output to external tools Source: https://github.com/stripe/stripe-cli/wiki/HTTP-(get,-post-&-delete)-commands Combine CLI commands with tools like jq and xargs to process API responses and trigger subsequent requests. ```sh $ stripe get /subscriptions -d status=past_due | jq ".data[].id" | xargs -I % -p stripe delete /subscriptions/% ``` -------------------------------- ### Verify Status Command Execution Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that the `stripe status` command runs without errors. ```bash stripe status ``` -------------------------------- ### Move ZSH completion script Source: https://github.com/stripe/stripe-cli/wiki/Completion-command Move the generated completion file to a dedicated directory for ZSH to locate. ```bash mv stripe-completion.zsh ~/.stripe ``` -------------------------------- ### Increase Go Test Timeout Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Runs Go tests with an increased timeout of 30 minutes for all tests in the canary directory. ```bash go test -v -timeout 30m ./canary/... ``` -------------------------------- ### Forward webhooks to a local URL Source: https://github.com/stripe/stripe-cli/wiki/Listen-command Forwards all incoming webhook events to a specified local URL and returns a signing secret. ```sh $ stripe listen --forward-to https://example.com/hooks > Ready! Your webhook signing secret is whsec_oZ8nus9PHnoltEtWZ3pGITZdeHWHoqnL (^C to quit) ``` -------------------------------- ### Invoke Local Stripe CLI Source: https://github.com/stripe/stripe-cli/wiki/Developing-the-Stripe-CLI Run the local version of the Stripe CLI using this command. This requires you to be in the 'stripe-cli' directory. ```sh go run cmd/stripe/main.go ``` -------------------------------- ### Create Development Alias Source: https://github.com/stripe/stripe-cli/wiki/Developing-the-Stripe-CLI Optionally, create a shell alias to easily invoke the local Stripe CLI. This alias only works when executed from the 'stripe-cli' directory. ```sh alias stripe-dev='go run cmd/stripe/main.go' ``` -------------------------------- ### Test Config-Based Authentication Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that authentication works correctly when using a configured API key set via `stripe config --set`. ```bash stripe config --set ``` -------------------------------- ### Set Stripe CLI Binary Path Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Set the STRIPE_CLI_BINARY environment variable to the path of the compiled Stripe CLI binary. This is required for running tests directly. ```bash export STRIPE_CLI_BINARY=$(pwd)/stripe ``` -------------------------------- ### Test Webhook Listener Secret Printing Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that the `stripe listen --print-secret` command correctly prints the webhook listener secret. ```bash stripe listen --print-secret ``` -------------------------------- ### Unset configuration value Source: https://github.com/stripe/stripe-cli/wiki/Config-command Removes a configuration key using the --unset flag. ```sh $ stripe config --unset ``` -------------------------------- ### Test Webhook Event Filtering Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that event filtering works correctly with the `stripe listen --events ... --print-secret` command. ```bash stripe listen --events ... --print-secret ``` -------------------------------- ### Test Log Filtering by HTTP Method Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Tests that log filtering works correctly using the `--filter-http-method` flag with `stripe logs tail`. ```bash stripe logs tail --filter-http-method POST ``` -------------------------------- ### Test Logs Tail JSON Output Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Verifies that `stripe logs tail --format JSON` captures requests correctly in JSON format when an API call is made. ```bash stripe logs tail --format JSON ``` -------------------------------- ### Resend Webhook Event by ID Source: https://github.com/stripe/stripe-cli/wiki/Events-resend-command Use this command to resend a specific webhook event. Replace `` with the actual ID of the event you wish to resend. ```bash stripe events resend ``` -------------------------------- ### Filter webhook events Source: https://github.com/stripe/stripe-cli/wiki/Listen-command Limits the events received by the CLI using a comma-separated list of event types. ```sh $ stripe listen --events=payment_intent.created,payment_intent.succeeded ``` -------------------------------- ### Run Offline Canary Tests Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Execute offline canary tests that do not require API access. These tests verify basic CLI functionality. ```bash make canary-offline ``` -------------------------------- ### Check Stripe service status Source: https://github.com/stripe/stripe-cli/wiki/Status-command Displays the current operational status of Stripe services. ```bash $ stripe status ✔ All services are online. As of: July 23, 2019 @ 07:52PM +00:00 ``` -------------------------------- ### Stripe Payment Intent JSON Object Source: https://github.com/stripe/stripe-cli/blob/master/pkg/docs/markdown/testdata/showcase.md A sample JSON object representing a Stripe Payment Intent. It includes common fields like ID, amount, currency, and status. ```json { "id": "pi_123", "object": "payment_intent", "amount": 2000, "currency": "usd", "status": "succeeded" } ``` -------------------------------- ### Set Custom Timeout for Stripe CLI Runner Source: https://github.com/stripe/stripe-cli/blob/master/canary/README.md Configures the Stripe CLI runner to use a custom timeout of 2 minutes for specific tests. ```go runner = runner.WithTimeout(2 * time.Minute) ``` -------------------------------- ### Plain Text Code Block Source: https://github.com/stripe/stripe-cli/blob/master/pkg/docs/markdown/testdata/showcase.md A code block without specified language, rendering as plain text. Useful for displaying unformatted text or code snippets where syntax highlighting is not needed. ```text plain text block no syntax highlighting ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.