Skip to content

Commit 034b0f9

Browse files
committed
fix(email): use isProPlan to catch org-level subscriptions in abandoned checkout guard
1 parent 2ee2115 commit 034b0f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/sim/lib/billing/webhooks/checkout.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { createLogger } from '@sim/logger'
44
import { eq } from 'drizzle-orm'
55
import type Stripe from 'stripe'
66
import { getEmailSubject, renderAbandonedCheckoutEmail } from '@/components/emails'
7-
import { hasPaidSubscription } from '@/lib/billing/core/subscription'
7+
import { isProPlan } from '@/lib/billing/core/subscription'
88
import { sendEmail } from '@/lib/messaging/email/mailer'
99
import { getPersonalEmailFrom } from '@/lib/messaging/email/utils'
1010

@@ -38,8 +38,8 @@ export async function handleAbandonedCheckout(event: Stripe.Event): Promise<void
3838
return
3939
}
4040

41-
// Skip if the user has since completed a subscription (first session expired after successful second)
42-
const alreadySubscribed = await hasPaidSubscription(userData.id)
41+
// Skip if the user already has a paid plan (direct or via org) — covers session expiring after a successful upgrade
42+
const alreadySubscribed = await isProPlan(userData.id)
4343
if (alreadySubscribed) return
4444

4545
const { from, replyTo } = getPersonalEmailFrom()

0 commit comments

Comments
 (0)