#E-Commerce

How to test Stripe Webhooks on the localhost

Posted on 08 Mar 2018

Stripe Webhooks can be used for variety of applications, like sending emails triggered by successful charges, broadcasting information that Source changed status to Chargeable, and many more behind-the-scenes events.

However, during development, testing webhooks on your localhost may be a tricky part. How one can set localhost address to be reached through webhook ping? Luckily, there are numerous tools that can help, such as ngrok, easy to install, single binary with zero run-time dependencies for any major platform.

Implementation is rather easy, with steps as follows:

  • Download version of ngrok which suits your OS
  • Execute ngrok.exe http 80, or whatever port you want to use
  • Head to Stripe API webhooks page and use urls provided by ngrok (Forwarding section) as urls for webhook to use

So, in this specific case (url will change every time ngrok starts or when session expires), if you wish to ping http://localhost/ping-me, you should use http://4bd4c442.ngrok.io/ping-me url in the Stripe Dashboard.

This is only one example of ngrok implementation, it is great tool for demoing web sites without deploying, building webhook consumers on your dev machine, testing mobile apps connected to your locally running backend, stable addresses for your connected devices that are deployed in the field, running personal cloud services from your home and much more.

Other Blog Entries

#Security

Still not on HTTPS? We have some bad news.

Author Marsmedia HQ 01 Sep 2017

#E-Commerce

How to test Stripe Webhooks on the localhost

Author Marsmedia HQ 08 Mar 2018

#Security

How to secure your online accounts and data

Author Srdan Stojkovic 15 May 2018

Contact

Whether you have a question, suggestion or feedback, our team is always here to assist you. We believe that communication is key to building strong and long-lasting relationships, and we are committed to providing you with the best possible support.