Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stripe/stripe-cli
A command-line tool for Stripe
https://github.com/stripe/stripe-cli
Last synced: 12 days ago
JSON representation
A command-line tool for Stripe
- Host: GitHub
- URL: https://github.com/stripe/stripe-cli
- Owner: stripe
- License: apache-2.0
- Created: 2019-06-14T00:01:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T00:09:57.000Z (6 months ago)
- Last Synced: 2024-05-29T06:23:29.204Z (6 months ago)
- Language: Go
- Homepage: https://stripe.com/docs/stripe-cli
- Size: 10.2 MB
- Stars: 1,555
- Watchers: 47
- Forks: 361
- Open Issues: 151
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Stripe CLI
![GitHub release (latest by date)](https://img.shields.io/github/v/release/stripe/stripe-cli)
[![Build Status](https://travis-ci.org/stripe/stripe-cli.svg?branch=master)](https://travis-ci.org/stripe/stripe-cli)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](docs/demo.gif)
## Installation
Stripe CLI is available for macOS, Windows, and Linux for distros like Ubuntu, Debian, RedHat and CentOS.
### macOS
Stripe CLI is available on macOS via [Homebrew](https://brew.sh/):
```sh
brew install stripe/stripe-cli/stripe
```### Linux
Refer to the [installation instructions](https://stripe.com/docs/stripe-cli#install) for available Linux installation options.
### Windows
Stripe CLI is available on Windows via the [Scoop](https://scoop.sh/) package manager:
```sh
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`](https://hub.docker.com/r/stripe/stripe-cli).
```sh
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`
```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
fistring="$@"
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
```2. Create a docker file `Dockerfile-cli`
```sh
FROM stripe/stripe-cli:vx.x.x
RUN apk add pass gpg-agent
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
```3. Build the docker image
```sh
docker build -t stripe-cli -f Dockerfile-cli .
```4. Run the docker image with password volumes, replacing `$command` with the appropraite Stripe CLI command (i.e `customers list`)
```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
```> For live mode requests append `--live` after `$command`.
### Without package managers
Instructions are also available for installing and using the CLI [without a package manager](https://github.com/stripe/stripe-cli/wiki/Installing-and-updating#without-a-package-manager).
## Usage
Installing the CLI provides access to the `stripe` command.
```sh-session
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:
- [`login`](https://stripe.com/docs/cli/login)
- [`listen`](https://stripe.com/docs/cli/listen)
- [`trigger`](https://stripe.com/docs/cli/trigger)
- [`logs tail`](https://stripe.com/docs/cli/logs/tail)
- [`events resend`](https://stripe.com/docs/cli/events/resend)
- [`samples`](https://stripe.com/docs/cli/intro_stripe_samples)
- [`serve`](https://stripe.com/docs/cli/serve)
- [`status`](https://stripe.com/docs/cli/status)
- [`config`](https://stripe.com/docs/cli/config)
- [`open`](https://stripe.com/docs/cli/open)
- [`get`, `post` & `delete` commands](https://stripe.com/docs/cli/get)
- [`resource` commands](https://stripe.com/docs/cli/resources)## Documentation
For a full reference, see the [CLI reference site](https://stripe.com/docs/cli)
## Telemetry
The Stripe CLI includes a telemetry feature that collects some usage data. See our [telemetry reference](https://stripe.com/docs/cli/telemetry) for details.
## Feedback
Got feedback for us? Please don't hesitate to tell us on [feedback](https://stri.pe/cli-feedback).
## Contributing
See [Developing the Stripe CLI](../../wiki/developing-the-stripe-cli) for more info on how to make contributions to this project.
## License
Copyright (c) Stripe. All rights reserved.Licensed under the [Apache License 2.0 license](blob/master/LICENSE).