Stripe.Webhook reference
ConsumeEventsLive
Section titled “ConsumeEventsLive”Source:
src/Stripe/ConsumeEvents.tsKind: Layer · Provides:Stripe.EventSource
Cloudflare Worker implementation of consumeEvents.
Deploy-time: provisions a WebhookEndpoint pointing at this Worker
(at the subscribed path) and binds its minted signing secret onto the
Worker so deliveries can be verified. Runtime: registers a fetch
listener that claims requests on that path, verifies Stripe-Signature,
and runs the handler once per event.
RetrieveWebhookEndpoint
Section titled “RetrieveWebhookEndpoint”Source:
src/Stripe/RetrieveWebhookEndpoint.ts
Retrieve a bound Stripe Webhook Endpoint over HTTP.
RetrieveWebhookEndpoint: Reading a Webhook Endpoint
Section titled “RetrieveWebhookEndpoint: Reading a Webhook Endpoint”const retrieve = yield* Stripe.RetrieveWebhookEndpoint(hook);const live = yield* retrieve();RetrieveWebhookEndpointHttp
Section titled “RetrieveWebhookEndpointHttp”Source:
src/Stripe/RetrieveWebhookEndpointHttp.tsKind: Layer · Provides:Stripe.RetrieveWebhookEndpoint
HTTP implementation of RetrieveWebhookEndpoint. Provide it on the
Function or Worker Effect.
WebhookEndpoint
Section titled “WebhookEndpoint”Source:
src/Stripe/WebhookEndpoint.ts
A Stripe webhook endpoint — the HTTPS destination Stripe POSTs
event payloads to. URL, enabled events, description, disabled, and
metadata update in place. The signing secret is returned only on
create and is stored as Redacted. Deleting the resource deletes
the endpoint.
WebhookEndpoint: Creating an endpoint
Section titled “WebhookEndpoint: Creating an endpoint”Charge events
const webhook = yield* Stripe.WebhookEndpoint("Charges", { url: "https://example.com/alchemy-stripe-webhook", enabledEvents: ["charge.succeeded", "charge.failed"],});Event classes, for a Worker URL you already have
const webhook = yield* Stripe.WebhookEndpoint("Events", { url: Output.interpolate`${api.url}/webhooks/stripe`, enabledEvents: [Stripe.CustomerCreated, Stripe.InvoicePaid],});yield* Stripe.bindWebhookSecret(api, webhook.secret);On a Worker, prefer consumeEvents — it provisions this endpoint and
binds the secret for you.
Description, metadata, and all events
const webhook = yield* Stripe.WebhookEndpoint("AllEvents", { url: "https://example.com/alchemy-stripe-webhook", enabledEvents: ["*"], description: "Alchemy test webhook", metadata: { purpose: "billing" },});WebhookEndpoint: Disabling an endpoint
Section titled “WebhookEndpoint: Disabling an endpoint”const webhook = yield* Stripe.WebhookEndpoint("Charges", { url: "https://example.com/alchemy-stripe-webhook", enabledEvents: ["charge.succeeded"], disabled: true,});