Skip to content
GitHubXDiscordRSS

WebhookEndpoint

Learn how to create and manage Stripe Webhook Endpoints using Alchemy to receive events from Stripe.

The WebhookEndpoint resource lets you create and manage Stripe Webhook Endpoints to receive notifications about events in your Stripe account.

Create a basic webhook endpoint to receive payment notifications:

import { WebhookEndpoint } from "alchemy/stripe";
const webhook = await WebhookEndpoint("payments", {
url: "https://api.example.com/webhooks/stripe",
enabledEvents: ["payment_intent.succeeded", "payment_intent.payment_failed"],
description: "Payment notifications webhook",
});

Create a webhook to monitor subscription lifecycle events:

import { WebhookEndpoint } from "alchemy/stripe";
const webhook = await WebhookEndpoint("subscriptions", {
url: "https://api.example.com/webhooks/subscriptions",
enabledEvents: [
"customer.subscription.created",
"customer.subscription.updated",
"customer.subscription.deleted",
"invoice.payment_succeeded",
"invoice.payment_failed",
],
metadata: {
type: "subscription-events",
},
});

Create a webhook for Stripe Connect platform events:

import { WebhookEndpoint } from "alchemy/stripe";
const webhook = await WebhookEndpoint("connect", {
url: "https://api.example.com/webhooks/connect",
enabledEvents: [
"account.updated",
"account.application.deauthorized",
"payout.created",
"payout.failed",
],
connect: true,
metadata: {
platform: "connect",
},
});