最近RailsをStripeと連携する勉強をしていたらstripe_CLIをダウンロードしてwebhook関連を確認しなければいけない場面が出てきた。なんか公式(https://stripe.com/docs/stripe-cli)だとzipダウンロードすりゃ簡単にできるだろと書いていたが何時間か迷った。
windowsでstripe loginするまで
まずGithubでwindows用のzipをダウンロードする。(https://github.com/stripe/stripe-cli/releases/tag/v1.15.0)自分の時はstripe_1.15.0_windows_x86_64.zipだった。

んでDL終わったらファイルがあると思うので解凍/展開。その中にstripe.exeがあるのを確認。
確認したらそのディレクトリのパスをコピーしておく。自分の場合はC:\Users\PC_User\Downloads\stripe_1.15.0_windows_x86_64だった。
そのあとそのディレクトリ上でstripe.exeを起動する。
C:cd C:\Users\PC_User\Downloads\stripe_1.15.0_windows_x86_64
C:\Users\PC_User\Downloads\stripe_1.15.0_windows_x86_64>stripe.exe
The official command-line tool to interact with Stripe.
Before using the CLI, you'll need to login:
$ stripe login
If you're working on multiple projects, you can run the login command with the
--project-name flag:
$ stripe login --project-name rocket-rides
Usage:
stripe [command]
Webhook commands:
listen Listen for webhook events
trigger Trigger test webhook events
Stripe commands:
logs Interact with Stripe API request logs
Resource commands:
get Quickly retrieve resources from Stripe
charges Make requests (capture, create, list, etc) on charges
customers Make requests (create, delete, list, etc) on customers
payment_intents Make requests (cancel, capture, confirm, etc) on payment intents
... To see more resource commands, run `stripe resources help`
Other commands:
community Chat with Stripe engineers and other developers
completion Generate bash and zsh completion scripts
config Manually change the config values for the CLI
feedback Provide us with feedback on the CLI
fixtures Run fixtures to populate your account with data
help Help about any command
login Login to your Stripe account
logout Logout of your Stripe account
open Quickly open Stripe pages
samples Sample integrations built by Stripe
serve Serve static files locally
version Get the version of the Stripe CLI
Flags:
--api-key string Your API key to use for the command
--color string turn on/off color output (on, off, auto)
--config string config file (default is
$HOME/.config/stripe/config.toml)
--device-name string device name
-h, --help help for stripe
--log-level string log level (debug, info, trace, warn, error)
(default "info")
-p, --project-name string the project name to read from for config
(default "default")
-v, --version Get the version of the Stripe CLI
Use "stripe [command] --help" for more information about a command.
以上のようになったら成功である。そのあとは「stripe login」をする。
C:\Users\PC_User\Downloads\stripe_1.15.0_windows_x86_64>stripe login
stripe loginでSorry, something went wrong. We’ve already been notified of the problemになってしまう
失敗すると以下のような画面になってしまうかもしれない。
Your pairing code is: ****-****-****-****
This pairing code verifies your authentication with Stripe.
Press Enter to open the browser or visit https://dashboard.stripe.com/stripecli/confirm_auth?*****(^C to quit)unexpected http status code: 503 {
"error": {
"message": "Sorry, something went wrong. We've already been notified of the problem, but if you need any help, you can reach us at support.stripe.com/contact.",
"type": "api_error"
}
}
その場合はそこに書いてあるhttps://dashboard.stripe.com/stripecli/confirm_auth?****にアクセスしてログインして再度コマンドプロンプトでstripe loginすると成功するはずだ。
僕の場合はなぜか分からないが時間を置くとloginできるようになった。