0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

#Stripe ダッシュボードで作成したイベントの web hook を stripe cli のローカル環境で受け取る

Last updated at Posted at 2019-12-13

How to

CLIでイベントをトリガーする

stripe listen

これだけ!

ダッシュボードにすぐデバイスが現れる。

Stripe CLI のイベントを受信するデバイス
Stripe CLI を利用してテストモードのイベントをリッスンしトリガーします。

image

イベント発行をテスト

Stripeダッシュボードから顧客を作成してみる.

image

結果

localでイベントを受け取ることができる!

$ stripe listen
> Ready! Your webhook signing secret is xxxxxxxxxxxxxxxxxxxxxxxxxxxx(^C to quit)
2019-12-13 07:41:06   --> customer.created [evt_1Fp0LGCmti5jpytUYaiA0xBE]

ちなみに

webhookを転送する

listenはイベントを聞くだけなので、これをlocalのエンドポイントに転送するには --forward させる

stripe listen --forward-to localhost:5000/webhooks

Webhook送信テスト?

ちなみに stripe cli はあくまでイベントをトリガーしているのであって、設定済みのWebHookへの直接送信をしてみても、cliでトリガーできるわけではないようだ。

image

つまり

この二つの流れだ

  • Stripeのイベント --> webhookリクエストが送信される
  • Stripeのイベント --> stripe cli でトリガー --> local で特定のエンドポイントにwebhookリクエストを転送する

Ref

Configuring the Endpoint | Stripe
https://stripe.com/docs/webhooks/configure#send-test-event

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?