Stripe Webhook
Last updated
Last updated
Log in to your Stripe Dashboard.
Go to Developers > Webhooks.
Click + Add endpoint.
Enter Endpoint URL.
Url Format : https://domain.com/api/stripe-webhook
If you want to test in development mode, you'll need to create a webhook in test mode. Since using localhost can be inconvenient, you can use a proxy to obtain an HTTPS link. A good option for this is the ngrok service, which is free.
Download ngrok: Get it from .
Sign up: Create an account on their website to get an API key.
Setup: Follow the instructions here: .
Make sure to replace port 80 with your actual port (likely 3000). When you run the command ngrok http 3000, you'll receive an HTTPS link. You can use this link to access your site and create a webhook in test mode.
When you're ready to test in live mode, Switch to Live Mode in Stripe Dashboard and follow the same steps to set up your webhook.
customer.subscription.created
customer.subscription.deleted
customer.subscription.updated
payment_intent.succeeded
After setting up the webhook, click on the endpoint to view its details.
Stripe provides a Signing Secret for each webhook endpoint. This secret is used to verify that incoming requests are from Stripe.
Copy the Signing Secret (which starts with whsec_
) and paste it into your .env
file next to
STRIPE_WEBHOOK_SECRET variable.