diff --git a/packages/billing/gateway/src/server/services/billing-webhooks/billing-webhooks.service.ts b/packages/billing/gateway/src/server/services/billing-webhooks/billing-webhooks.service.ts index 587b14aaa..2c38625de 100644 --- a/packages/billing/gateway/src/server/services/billing-webhooks/billing-webhooks.service.ts +++ b/packages/billing/gateway/src/server/services/billing-webhooks/billing-webhooks.service.ts @@ -23,7 +23,14 @@ class BillingWebhooksService { async handleSubscriptionDeletedWebhook(subscription: Subscription) { const gateway = createBillingGatewayService(subscription.billing_provider); - await gateway.cancelSubscription({ + const subscriptionData = await gateway.getSubscription(subscription.id); + const isCanceled = subscriptionData.status === 'canceled'; + + if (isCanceled) { + return; + } + + return gateway.cancelSubscription({ subscriptionId: subscription.id, }); }