Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Disable changing of subscription from teams tier

Joshen Limd875050dae6f
diff --git a/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx
index f31eb7e8c6e..3de3f9a3f9c 100644
--- a/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx
+++ b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx
@@ -3,7 +3,7 @@ import { Button, IconLoader } from 'ui'
import * as Tooltip from '@radix-ui/react-tooltip'
import { useFlag } from 'hooks'
-import { STRIPE_PRODUCT_IDS } from 'lib/constants'
+import { PRICING_TIER_PRODUCT_IDS, STRIPE_PRODUCT_IDS } from 'lib/constants'
import { StripeProduct } from 'components/interfaces/Billing'
import { useIsProjectActive } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -17,6 +17,8 @@ const PlanCTAButton = ({ plan, currentPlan, onSelectPlan }: PlanCTAButtonProps)
const isProjectActive = useIsProjectActive()
const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')
+ const isTeamTier = currentPlan?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
+
const getButtonType = (plan: any, currentPlan: any) => {
if (['Free tier'].includes(plan.name)) {
// Free is always default
@@ -86,6 +88,7 @@ const PlanCTAButton = ({ plan, currentPlan, onSelectPlan }: PlanCTAButtonProps)
const ctaText = getButtonText(plan, currentPlan)
const disabled =
(!isProjectActive && plan.name !== 'Enterprise') ||
+ (isTeamTier && plan.name !== 'Enterprise' && plan.name !== 'Team tier') ||
(plan.id === STRIPE_PRODUCT_IDS.FREE && currentPlan.prod_id === STRIPE_PRODUCT_IDS.FREE)
if (plan.name === 'Enterprise') {
@@ -113,7 +116,7 @@ const PlanCTAButton = ({ plan, currentPlan, onSelectPlan }: PlanCTAButtonProps)
{ctaText}
</Button>
</Tooltip.Trigger>
- {(projectUpdateDisabled || !isProjectActive) && (
+ {((disabled && isTeamTier) || projectUpdateDisabled || !isProjectActive) && (
<Tooltip.Portal>
<Tooltip.Portal>
<Tooltip.Content side="bottom">
@@ -129,6 +132,8 @@ const PlanCTAButton = ({ plan, currentPlan, onSelectPlan }: PlanCTAButtonProps)
? 'Subscription changes are currently disabled, our engineers are working on a fix'
: !isProjectActive
? 'Unable to update subscription as project is not active'
+ : isTeamTier
+ ? "Unable to update subscription from Team tier. Please reach out to us via support if you'd like to change your plan"
: ''}
</span>
</div>
diff --git a/studio/components/interfaces/Billing/Subscription/Subscription.tsx b/studio/components/interfaces/Billing/Subscription/Subscription.tsx
index f77be7f75d2..5aa70a9df21 100644
--- a/studio/components/interfaces/Billing/Subscription/Subscription.tsx
+++ b/studio/components/interfaces/Billing/Subscription/Subscription.tsx
@@ -43,9 +43,8 @@ const Subscription: FC<Props> = ({ showProjectName = false }) => {
const { data: usage } = useProjectUsageQuery({ projectRef })
const isPayg = subscription?.tier.prod_id === STRIPE_PRODUCT_IDS.PAYG
- const isTeams = subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
const isEnterprise = subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISE
- const canOnlyUpdateAddons = isTeams || isEnterprise
+ const canOnlyUpdateAddons = isEnterprise
const addOns = subscription?.addons ?? []
const paid = subscription && subscription.tier.unit_amount > 0
@@ -72,8 +71,6 @@ const Subscription: FC<Props> = ({ showProjectName = false }) => {
const subscriptionUpdateURL = isEnterprise
? `/project/${projectRef}/settings/billing/update/enterprise`
- : isTeams
- ? `/project/${projectRef}/settings/billing/update/team`
: `/project/${projectRef}/settings/billing/update`
useEffect(() => {
diff --git a/studio/pages/project/[ref]/settings/billing/update/index.tsx b/studio/pages/project/[ref]/settings/billing/update/index.tsx
index edd9d950568..4c6cba9f6eb 100644
--- a/studio/pages/project/[ref]/settings/billing/update/index.tsx
+++ b/studio/pages/project/[ref]/settings/billing/update/index.tsx
@@ -31,7 +31,6 @@ const BillingUpdate: NextPageWithLayout = () => {
const [subscription, setSubscription] = useState<StripeSubscription>()
const [selectedPlan, setSelectedPlan] = useState<any>()
- const isTeams = subscription?.tier?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
const isEnterprise = subscription?.tier?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISE
useEffect(() => {
@@ -44,8 +43,6 @@ const BillingUpdate: NextPageWithLayout = () => {
useEffect(() => {
if (isEnterprise) {
router.push(`/project/${projectRef}/settings/billing/update/enterprise`)
- } else if (isTeams) {
- router.push(`/project/${projectRef}/settings/billing/update/team`)
}
}, [subscription])