Testing Stripe webhook
This tutorial will show you how you can test your Stripe payment gateway webhooks.
1. Creating a simple webhook receiver
Here we use flask to create a simple webhook receiver, If the webhook receives a POST it will respond with a message. The flask application is set to run in port 8080.
Ideally, you would want to write statement for handling the events and exceptions with return codes.
You can then run your code.
2. Exposing your stripe webhook
LocalXpose should provide you with http/https tunnel endpoints.
3. Register a webhook
Click on 'Add endpoint'.
Enter your LocalXpose URL in format https://<username>:<password>@<localxposeurl>
Select event/s you want to generate.
Save by clicking 'Add endpoint'.
4. Triggering Events (Dashboard)
In order to test the working of your setup, we can trigger webhook events.
Click on 'Send test webhook'
Select the event you want to trigger.
Confirm by clicking 'Send test webhook'
You should see the return message from our webhook 'Yey! Success'.
5. Triggering Events (CLI)
i) Login to your stripe CLI.
ii) Create a forwarding listener
iii) Create a webhook event
You should receive the event and it will be forwarded to your webhook.
Last updated
Was this helpful?