Skip to content

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

feat: missing billing info banner (#38575)

Kevin Grünebergf5567f3a3c0d
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingCustomerData/BillingCustomerData.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingCustomerData/BillingCustomerData.tsx
index c52f590d526..0431d6c4cd0 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingCustomerData/BillingCustomerData.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingCustomerData/BillingCustomerData.tsx
@@ -111,7 +111,10 @@ export const BillingCustomerData = () => {
<div className="sticky space-y-2 top-12 pr-3">
<p className="text-foreground text-base m-0">Billing Address &amp; Tax ID</p>
<p className="text-sm text-foreground-light m-0">
- This will be reflected in every upcoming invoice, past invoices are not affected
+ Changes will be reflected in every upcoming invoice, past invoices are not affected
+ </p>
+ <p className="text-sm text-foreground-light m-0">
+ A Tax ID is only required for registered businesses.
</p>
</div>
</ScaffoldSectionDetail>
diff --git a/apps/studio/components/interfaces/Organization/restriction.constants.ts b/apps/studio/components/interfaces/Organization/restriction.constants.ts
index 5efa8882d27..0f70c9e8332 100644
--- a/apps/studio/components/interfaces/Organization/restriction.constants.ts
+++ b/apps/studio/components/interfaces/Organization/restriction.constants.ts
@@ -21,4 +21,9 @@ export const RESTRICTION_MESSAGES = {
title: 'Outstanding Invoices in other Organization',
message: 'Please pay invoices for other Organization to avoid service disruption.',
},
+ MISSING_BILLING_INFO: {
+ title: 'Missing Billing Information',
+ message:
+ 'Please add a billing address. If you are a registered business, please add a tax ID too.',
+ },
} as const
diff --git a/apps/studio/hooks/misc/useOrganizationRestrictions.ts b/apps/studio/hooks/misc/useOrganizationRestrictions.ts
index 7e56c4c423c..594bc8fcbae 100644
--- a/apps/studio/hooks/misc/useOrganizationRestrictions.ts
+++ b/apps/studio/hooks/misc/useOrganizationRestrictions.ts
@@ -4,6 +4,8 @@ import { RESTRICTION_MESSAGES } from 'components/interfaces/Organization/restric
import { useOverdueInvoicesQuery } from 'data/invoices/invoices-overdue-query'
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
+import { useBillingCustomerDataForm } from 'components/interfaces/Organization/BillingSettings/BillingCustomerData/useBillingCustomerDataForm'
+import { useOrganizationCustomerProfileQuery } from 'data/organizations/organization-customer-profile-query'
export type WarningBannerProps = {
type: 'danger' | 'warning' | 'note'
@@ -17,6 +19,7 @@ export function useOrganizationRestrictions() {
const { data: overdueInvoices } = useOverdueInvoicesQuery()
const { data: organizations } = useOrganizationsQuery()
+ const { data: billingCustomer } = useOrganizationCustomerProfileQuery({ slug: org?.slug })
const warnings: WarningBannerProps[] = []
@@ -27,6 +30,15 @@ export function useOrganizationRestrictions() {
(invoice) => invoice.organization_id === org?.id
)
+ if (org && org.plan.id !== 'free' && billingCustomer && !billingCustomer.address?.line1) {
+ warnings.push({
+ type: 'warning',
+ title: RESTRICTION_MESSAGES.MISSING_BILLING_INFO.title,
+ message: RESTRICTION_MESSAGES.MISSING_BILLING_INFO.message,
+ link: `/org/${org?.slug}/billing#address`,
+ })
+ }
+
if (thisOrgHasOverdueInvoices?.length) {
warnings.push({
type: 'danger',