How to Use localhost as Stripe Webhook URL

ngrok is a great tool and can be used to establish connection between local server and public internet over secure tunnels. This is a general purpose tool and can be used for a lot of tasks including stripe webhook url.

But for using local server as webhook endpoint for stripe, there is an even better alternative. Stripe itself provides a tool called Stripe cli which provide the functionality and you don’t need to rely on third-party tunneling software like ngrok


The official doc provides in depth guide on how to install it and covers all the major operating system.


To forward events to your local server, first you need to pair stripe cli with your stripe account. Type following in your terminal. You’ll be prompted to launch your browser and log in to the Stripe Dashboard to grant the Stripe CLI access to your account.

    stripe login

After pairing, you can now listen and forward received events to your local server with following command

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

You can do a lot more than just this with stripe cli. See the doc for all the use cases.

Leave A Comment