Skip to content

Commit 7328ef2

Browse files
committed
stripe webhook handling
1 parent 5d0f2a3 commit 7328ef2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • apps/backend/src/app/api/latest/integrations/stripe/webhooks

apps/backend/src/app/api/latest/integrations/stripe/webhooks/route.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ const subscriptionChangedEvents = [
4040
"payment_intent.canceled",
4141
] as const satisfies Stripe.Event.Type[];
4242

43+
const ignoredEvents = [
44+
"account.updated",
45+
"account.application.authorized",
46+
"capability.updated",
47+
"charge.failed",
48+
"balance.available",
49+
"customer.updated",
50+
] as const satisfies Stripe.Event.Type[];
51+
4352
const isSubscriptionChangedEvent = (event: Stripe.Event): event is Stripe.Event & { type: (typeof subscriptionChangedEvents)[number] } => {
4453
return subscriptionChangedEvents.includes(event.type as any);
4554
};
@@ -399,6 +408,10 @@ async function processStripeWebhookEvent(event: Stripe.Event): Promise<void> {
399408
});
400409
}
401410
}
411+
else if (typedIncludes(ignoredEvents, event.type)) {
412+
// These events are received but don't require processing
413+
return;
414+
}
402415
else {
403416
throw new StackAssertionError("Unknown stripe webhook type received: " + event.type, { event });
404417
}

0 commit comments

Comments
 (0)