We use cookies

We use cookies and similar technologies for analytics and marketing. You can allow these cookies or continue with only essential cookies.

By clicking "Accept", you agree to our use of cookies.
Learn more.

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:

FieldValue
Namestripe (or whatever you'd like)
SourceStripe
Event Key Expression'stripe:' + input.type
SecretYour 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:

class StripeObject(BaseModel):    customer: str    amount: intclass StripeData(BaseModel):    object: StripeObjectclass StripePaymentInput(BaseModel):    type: str    data: StripeDataclass StripePaymentOutput(BaseModel):    customer: str    amount: int@hatchet.task(    input_validator=StripePaymentInput,    on_events=["stripe:payment_intent.succeeded"],)def handle_stripe_payment(    input: StripePaymentInput, ctx: Context) -> StripePaymentOutput:    customer = input.data.object.customer    amount = input.data.object.amount    print(f"Payment of {amount} from {customer}")    return StripePaymentOutput(customer=customer, amount=amount)

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.

Last updated on August 11, 2026

On this page