Convert Figma logo to code with AI

stripe logostripe-cli

A command-line tool for Stripe

2,210
542
2,210
230

Top Related Projects

46,711

GitHub’s official command line tool

17,135

Universal Command Line Interface for Amazon Web Services

Quick Overview

The stripe-cli is a command-line interface tool developed by Stripe for interacting with the Stripe API. It provides developers with a convenient way to manage Stripe resources, test webhooks, and perform various Stripe-related tasks directly from the terminal.

Pros

  • Simplifies local development and testing of Stripe integrations
  • Offers real-time webhook event monitoring and forwarding
  • Provides easy access to Stripe API functionality through command-line commands
  • Supports multiple environments (test and live) with easy switching

Cons

  • Limited to command-line interface, which may not be suitable for all users
  • Requires separate installation and setup process
  • May have a learning curve for developers new to CLI tools
  • Some advanced features might require additional configuration

Getting Started

  1. Install the Stripe CLI:

    brew install stripe/stripe-cli/stripe
    
  2. Log in to your Stripe account:

    stripe login
    
  3. Listen for webhook events:

    stripe listen --forward-to localhost:3000/webhook
    
  4. Create a customer:

    stripe customers create --name="John Doe" --email="john@example.com"
    
  5. List recent payments:

    stripe payments list --limit 5
    

These instructions provide a quick start for installing the Stripe CLI, logging in, and performing basic operations. For more detailed usage and advanced features, refer to the official Stripe CLI documentation.

Competitor Comparisons

46,711

GitHub’s official command line tool

Pros of cli/cli

  • More comprehensive GitHub functionality, covering a wider range of GitHub features
  • Larger community and more frequent updates, leading to better support and faster bug fixes
  • Designed for general GitHub users, not limited to a specific service

Cons of cli/cli

  • Steeper learning curve due to more complex functionality
  • May include features unnecessary for users primarily focused on repository management

Code Comparison

stripe-cli:

stripe listen --forward-to localhost:3000/webhook

cli/cli:

gh repo create my-project --public
gh issue create --title "Bug report" --body "Description of the issue"

The stripe-cli example shows how to listen for webhook events, while cli/cli demonstrates creating a repository and an issue. This highlights the difference in focus between the two CLIs, with stripe-cli being more specialized for Stripe-related tasks and cli/cli offering broader GitHub functionality.

17,135

Universal Command Line Interface for Amazon Web Services

Pros of AWS CLI

  • More comprehensive feature set, covering a wider range of AWS services
  • Larger community and more extensive documentation
  • Supports multiple programming languages through SDKs

Cons of AWS CLI

  • Steeper learning curve due to the vast number of commands and options
  • Slower release cycle for new features compared to Stripe CLI
  • More complex installation process, especially on Windows

Code Comparison

AWS CLI example:

aws s3 cp myfile.txt s3://my-bucket/
aws ec2 describe-instances --filters "Name=instance-type,Values=t2.micro"

Stripe CLI example:

stripe listen --forward-to localhost:3000/webhook
stripe trigger payment_intent.succeeded

The AWS CLI typically requires more verbose commands with multiple options, while the Stripe CLI focuses on simpler, more specific actions related to Stripe's services.

Both CLIs offer powerful functionality for their respective platforms, but AWS CLI covers a broader range of services and has a more complex structure. Stripe CLI, on the other hand, provides a more streamlined experience focused on Stripe's payment processing and related features.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Stripe CLI

GitHub release (latest by date) Build Status

The Stripe CLI helps you build, test, and manage your Stripe integration right from the terminal.

With the CLI, you can:

  • Securely test webhooks without relying on 3rd party software
  • Trigger webhook events or resend events for easy testing
  • Tail your API request logs in real-time
  • Create, retrieve, update, or delete API objects.

demo

Installation

Stripe CLI is available for macOS, Windows, and Linux for distros like Ubuntu, Debian, RedHat and CentOS.

npm (macOS, Linux, Windows)

If you have Node.js >= 18 installed, you can install via npm:

npm install -g @stripe/cli

You can also directly execute commands via npx, although this won't add stripe to your PATH:

npx @stripe/cli login

macOS

Homebrew:

brew install stripe

Linux

apt (Debian, Ubuntu):

curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | gpg --dearmor | sudo tee /usr/share/keyrings/stripe.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | sudo tee -a /etc/apt/sources.list.d/stripe.list
sudo apt update
sudo apt install stripe

yum/dnf (RedHat, Fedora, CentOS):

echo -e "[Stripe]\nname=stripe\nbaseurl=https://packages.stripe.dev/stripe-cli-rpm-local/\nenabled=1\ngpgcheck=0" | sudo tee -a /etc/yum.repos.d/stripe.repo
sudo yum install stripe

Windows

WinGet:

winget install Stripe.StripeCLI

Scoop:

scoop bucket add stripe https://github.com/stripe/scoop-stripe-cli.git
scoop install stripe

Docker

The CLI is also available as a Docker image: stripe/stripe-cli.

docker run --rm -it stripe/stripe-cli version
stripe version x.y.z (beta)

Password Store Setup with Docker

While test mode doesn’t require password store, you will need to set it up if you wish to perform live mode requests.

You can also make live mode requests on a per command basis by attaching the --api-key flag.

  1. Create entrypoint.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
  1. Create a docker file Dockerfile-cli
FROM  stripe/stripe-cli:vx.x.x
RUN  apk  add  pass  gpg-agent
COPY  ./entrypoint.sh  /entrypoint.sh
ENTRYPOINT  [ "/entrypoint.sh" ]
  1. Build the docker image
docker build -t stripe-cli -f Dockerfile-cli .
  1. Run the docker image with password volumes, replacing $command with the appropraite Stripe CLI command (i.e customers list)
docker run --rm -it -v stripe-config://root/.config/stripe/ -v stripe-gpg://root/.gnupg/ -v stripe-pass://root/.password-store/ stripe-cli $command

For live mode requests append --live after $command.

Without package managers

Download the latest release for your platform from the GitHub Releases page.

macOS:

tar -xvf stripe_X.X.X_mac-os_ARCH.tar.gz

Optionally move the stripe binary to /usr/local/bin for global access.

Linux:

tar -xvf stripe_X.X.X_linux_x86_64.tar.gz

Move the stripe binary to a directory on your PATH.

Windows:

Unzip stripe_X.X.X_windows_x86_64.zip and add the path containing stripe.exe to your Path environment variable.

Note: Anti-virus software may flag the binary as unsafe. This is a false positive; see issue #692 for details.

Upgrading

npm (macOS, Linux, Windows)

npm install -g @stripe/cli

macOS

Homebrew:

brew upgrade stripe

Linux

apt (Debian, Ubuntu):

sudo apt update && sudo apt upgrade stripe

yum/dnf (RedHat, Fedora, CentOS):

yum update stripe

Windows

WinGet:

winget upgrade Stripe.StripeCLI

Scoop:

scoop update stripe

Docker

docker pull stripe/stripe-cli:latest

Because Docker containers are ephemeral, the stripe login command isn't supported. Use the --api-key flag instead.

Without package managers

Download the latest release for your platform from the GitHub Releases page and replace your existing binary.

Uninstalling

1. Remove your plugins

Package managers only remove the stripe binary; they leave installed plugins behind. Remove plugins first, while the stripe binary is still available:

stripe plugin uninstall --all

2. Remove the CLI

npm (macOS, Linux, Windows):

npm uninstall -g @stripe/cli

Homebrew (macOS):

brew uninstall stripe

apt (Debian, Ubuntu):

sudo apt remove stripe

yum/dnf (RedHat, Fedora, CentOS):

sudo yum remove stripe

WinGet (Windows):

winget uninstall Stripe.StripeCLI

Scoop (Windows):

scoop uninstall stripe

Docker:

docker rmi stripe/stripe-cli

Without package managers:

Delete the stripe binary you downloaded.

3. Optionally remove configuration and credentials

Uninstalling the CLI intentionally keeps your configuration, so reinstalling preserves your projects and settings. It is only removed if you remove it yourself:

# Clear stored credentials for every project you are logged into
stripe logout --all

# Remove all remaining CLI configuration
rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}/stripe"

Usage

Installing the CLI provides access to the stripe command.

stripe [command]

# Run `--help` for detailed information about CLI commands
stripe [command] help

Commands

The Stripe CLI supports a broad range of commands. Below are some of the most used ones:

Documentation

For a full reference, see the CLI reference site

Telemetry

The Stripe CLI includes a telemetry feature that collects some usage data. See our telemetry reference for details.

Feedback

Got feedback for us? Please don't hesitate to tell us on feedback.

Contributing

See CONTRIBUTING.md for details on developing the Stripe CLI. All contributions are governed by the code of conduct.

License

Copyright (c) Stripe. All rights reserved.

Licensed under the Apache License 2.0 license.