|
| 1 | +# Stripe Webhook Monitor |
| 2 | + |
| 3 | +`stripe-webhook-monitor` is a real-time monitor for Stripe webhooks that provides a live feeds and graph of recent events. |
| 4 | + |
| 5 | +<img src="https://raw.githubusercontent.com/stripe/stripe-webhook-monitor/master/screenshots/monitor-feed.gif" width="425"> <img src="https://raw.githubusercontent.com/stripe/stripe-webhook-monitor/master/screenshots/monitor-graph.gif" width="425"> |
| 6 | + |
| 7 | +Stripe's platform includes [webhooks](https://stripe.com/docs/webhooks) that will notify you when actions take place on your account. For example, you can be notified when: |
| 8 | + |
| 9 | + - New charges are created (`charge.created`) |
| 10 | + - Customers subscribe to a new plan (`customer.subscription.created`) |
| 11 | + - Payouts and transfers are completed (`payout.paid`) |
| 12 | + - An invoice payment failed (`invoice.payment_failed`) |
| 13 | + |
| 14 | +Webhooks are powerful: you can subscribe to these notifications and programmatically react to them in real-time. |
| 15 | + |
| 16 | +## Getting started |
| 17 | + |
| 18 | +### Set up the monitor |
| 19 | +Clone the project repository, and create a configuration for your Stripe account: |
| 20 | + |
| 21 | +``` |
| 22 | +cp config.sample.js config.js |
| 23 | +``` |
| 24 | + |
| 25 | +You'll need to fill in your Stripe secret key. |
| 26 | + |
| 27 | +Webhooks require a public URL that Stripe will ping to notify the monitor of new events. Support for [ngrok](https://ngrok.com/) is included out of the box: ngrok will create a secure tunnel and provide a public URL to your local machine. |
| 28 | + |
| 29 | +If you have a [__Basic__](https://ngrok.com/pricing) ngrok subscription, you can specify a custom subdomain that will stay reserved for your account. |
| 30 | + |
| 31 | +### Start receiving changes |
| 32 | + |
| 33 | +To start the monitor: |
| 34 | + |
| 35 | +``` |
| 36 | +npm install |
| 37 | +npm start |
| 38 | +``` |
| 39 | + |
| 40 | +Take note of the public URL provided by ngrok: it should be listed when the monitor starts. |
| 41 | + |
| 42 | +**Don't want to use ngrok?** As long as Stripe can reach the webhooks endpoint via a public URL, you'll receive updates. |
| 43 | + |
| 44 | +### Subscribe to webhook notifications |
| 45 | + |
| 46 | +In your Stripe Dashboard, go to the _API_ section, then click on the _Webhooks_ tab. |
| 47 | + |
| 48 | +You should add a receiving endpoint by clicking _Add Endpoint_. Fill in the public URL provided by ngrok, or any other public URL that can reach the webhook monitor. |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +## Troubleshooting |
| 53 | + |
| 54 | +### I'm not receiving real-time updates |
| 55 | + |
| 56 | +- Check that the [Stripe Dashboard](https://dashboard.stripe.com/webhooks/) is listing your webhook route as _Enabled_. |
| 57 | +- Make sure that the webhook endpoint matches the URL printed in your console. |
| 58 | + |
| 59 | +## Credits |
| 60 | + |
| 61 | +- Code: [Michael Glukhovsky](https://twitter.com/mglukhovsky) |
| 62 | +- Icons: [Ionicons](http://ionicons.com/) |
0 commit comments