diff --git a/packages/features/ee/billing/api/webhook/_invoice.paid.ts b/packages/features/ee/billing/api/webhook/_invoice.paid.ts index 123fecf777..6d524fb296 100644 --- a/packages/features/ee/billing/api/webhook/_invoice.paid.ts +++ b/packages/features/ee/billing/api/webhook/_invoice.paid.ts @@ -1,6 +1,5 @@ import logger from "@calcom/lib/logger"; -import { HttpCode } from "./__handler"; import type { LazyModule, SWHMap } from "./__handler"; type Data = SWHMap["invoice.paid"]["data"]; @@ -30,10 +29,20 @@ const stripeWebhookProductHandler = (handlers: Handlers) => async (data: Data) = } const handlerGetter = handlers[productId as keyof typeof handlers]; - if (!handlerGetter) throw new HttpCode(202, `No product handler found for product: ${productId}`); + + /** + * If no handler is found, we skip the product. A handler could be null if we don't need webhooks to handle the business logic for the product. + */ + if (!handlerGetter) { + log.error(`Skipping product: ${productId} because no handler found`); + return { success: true }; + } const handler = (await handlerGetter())?.default; // auto catch unsupported Stripe products. - if (!handler) throw new HttpCode(202, `No product handler found for product: ${productId}`); + if (!handler) { + log.error(`Skipping product: ${productId} because no handler found`); + return { success: true }; + } return await handler(data); };