Skip to content

Commit 154ed37

Browse files
committed
fail loudly if stripe sub id missing
1 parent e09b32a commit 154ed37

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

apps/sim/lib/billing/client/upgrade.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ export function useSubscriptionUpgrade() {
5757
currentStripeSubscriptionId = undefined
5858
}
5959

60+
if (currentSubscriptionRowId && !currentStripeSubscriptionId) {
61+
logger.error('Active paid subscription is missing its Stripe subscription ID', {
62+
userId,
63+
subscriptionRowId: currentSubscriptionRowId,
64+
targetPlan,
65+
})
66+
throw new Error(
67+
'We could not match your current plan with our payment provider. Please contact support before upgrading so you are not charged twice.'
68+
)
69+
}
70+
6071
let referenceId = userId
6172

6273
if (targetPlan === 'team') {

0 commit comments

Comments
 (0)