diff --git a/apps/builder/src/features/billing/api/updateSubscription.ts b/apps/builder/src/features/billing/api/updateSubscription.ts index 7070357e7..f96cda1b3 100644 --- a/apps/builder/src/features/billing/api/updateSubscription.ts +++ b/apps/builder/src/features/billing/api/updateSubscription.ts @@ -49,7 +49,7 @@ export const updateSubscription = authenticatedProcedure id: workspaceId, }, select: { - isQuarantined: true, + isPastDue: true, stripeId: true, members: { select: { @@ -59,6 +59,12 @@ export const updateSubscription = authenticatedProcedure }, }, }) + if (workspace?.isPastDue) + throw new TRPCError({ + code: 'BAD_REQUEST', + message: + 'You have unpaid invoices. Please head over your billing portal to pay it.', + }) if ( !workspace?.stripeId || isAdminWriteWorkspaceForbidden(workspace, user) diff --git a/apps/builder/src/features/dashboard/components/DashboardHeader.tsx b/apps/builder/src/features/dashboard/components/DashboardHeader.tsx index 947ca1409..ce78662f9 100644 --- a/apps/builder/src/features/dashboard/components/DashboardHeader.tsx +++ b/apps/builder/src/features/dashboard/components/DashboardHeader.tsx @@ -37,7 +37,7 @@ export const DashboardHeader = () => { /> - {user && workspace && ( + {user && workspace && !workspace.isPastDue && ( { workspace={workspace} /> )} - + {!workspace?.isPastDue && ( + + )}