Testing Stripe webhook
This tutorial will show you how you can test your Stripe payment gateway webhooks.
1. Creating a simple webhook receiver
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/', methods=['POST']) #You may add other route eg: '/webhook'
def webhook():
data = request.get_json(silent=True)
print(data) #Prints payload
return jsonify('Yey! Success') #Returns happy message
if __name__ == '__main__':
app.run(port=8080) #Running on port 8080
python stripe_webhook.py
2. Exposing your stripe webhook

3. Register a webhook

4. Triggering Events (Dashboard)

5. Triggering Events (CLI)
i) Login to your stripe CLI.
ii) Create a forwarding listener
iii) Create a webhook event
Last updated