Stripe Webhooks
Stripe sends webhooks for all sorts of events, such as payments succeeding, subscription cancellations, invoice creation, and so on. This guide walks through setting up webhooks from Stripe to trigger events directly in Hatchet.
Setup
Get your Stripe webhook signing secret
In the Stripe Dashboard, you’ll create a new webhook endpoint. Don’t fill in the URL yet — you’ll get that from Hatchet in the next step. See Stripe’s webhooks guide for more details on setting this up.
For now, note the signing secret that Stripe generates for you (it starts with whsec_). You’ll need this to tell Hatchet how to verify incoming requests.
Create the webhook in Hatchet
In the Hatchet dashboard, go to Webhooks and create a new webhook with the following settings:
| Field | Value |
|---|---|
| Name | stripe (or whatever you’d like) |
| Source | Stripe |
| Event Key Expression | 'stripe:' + input.type |
| Secret | Your whsec_... signing secret |
The event key expression here takes the type field from Stripe’s payload (something like payment_intent.created) and prefixes it with stripe: so your event keys are namespaced. When a webhook from Stripe is ingested with an input.type of payment_intent.created, there will be a corresponding Hatchet event with a key of stripe:payment_intent.created created.
Once you’ve created the webhook, copy the URL that Hatchet generates.
Add the URL to Stripe
Go back to the Stripe Dashboard webhook you created in step 1 and paste in the Hatchet webhook URL. Select the events you want to listen for (or just select all of them — Hatchet will only trigger workflows that match the event key).
Write a task that listens for Stripe events
Now you just need a task with a matching on_events trigger. For example, to handle successful payments:
Test it
You can use Stripe’s “Send test webhook” feature in the dashboard, or trigger a real event in test mode. You should see the task run appear in the Hatchet dashboard.