Skip to content

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

fix: in-arrears transition in upcoming invoice (#45765)

Ignacio Dobronicha4f964e45271
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/UpcomingInvoice.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/UpcomingInvoice.tsx
index 0d75d521cd6..889f5036fdc 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/UpcomingInvoice.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/UpcomingInvoice.tsx
@@ -1,4 +1,3 @@
-import Link from 'next/link'
import React from 'react'
import { Table, TableBody, TableCell, TableFooter, TableRow } from 'ui'
import { InfoTooltip } from 'ui-patterns/info-tooltip'
@@ -12,6 +11,7 @@ import {
UpcomingInvoiceResponse,
useOrgUpcomingInvoiceQuery,
} from '@/data/invoices/org-invoice-upcoming-query'
+import { useOrganizationQuery } from '@/data/organizations/organization-query'
import { DOCS_URL } from '@/lib/constants'
import { formatCurrency } from '@/lib/helpers'
@@ -58,6 +58,8 @@ export const UpcomingInvoice = ({ slug }: UpcomingInvoiceProps) => {
isSuccess,
} = useOrgUpcomingInvoiceQuery({ orgSlug: slug })
+ const { data: organization } = useOrganizationQuery({ slug })
+
// For non-platform customers, compute is broken down per project and contains a breakdown array
const computeItems =
upcomingInvoice?.lines?.filter(
@@ -100,6 +102,9 @@ export const UpcomingInvoice = ({ slug }: UpcomingInvoiceProps) => {
upcomingInvoice?.tax_status === 'calculated' && (upcomingInvoice?.tax?.tax_amount ?? 0) > 0
const taxFailed = upcomingInvoice?.tax_status === 'failed'
+ const planFeePaidInAdvance =
+ !planItem && upcomingInvoice?.fixed_fees_billing_mode === 'in_arrears'
+
return (
<>
{isLoading && (
@@ -117,19 +122,21 @@ export const UpcomingInvoice = ({ slug }: UpcomingInvoiceProps) => {
<div>
<Table className="w-full text-sm">
<TableBody>
- <TableRow>
- <TableCell className="py-2! px-0">{planItem?.description}</TableCell>
- <TableCell className="text-right py-2 px-0">
- {planItem == null ? (
- '-'
- ) : (
- <InvoiceLineItemAmount
- amount={planItem.amount}
- amountBeforeDiscount={planItem.amount_before_discount}
- />
- )}
- </TableCell>
- </TableRow>
+ {!planFeePaidInAdvance && (
+ <TableRow>
+ <TableCell className="py-2! px-0">{planItem?.description}</TableCell>
+ <TableCell className="text-right py-2 px-0">
+ {!planItem ? (
+ '-'
+ ) : (
+ <InvoiceLineItemAmount
+ amount={planItem.amount}
+ amountBeforeDiscount={planItem.amount_before_discount}
+ />
+ )}
+ </TableCell>
+ </TableRow>
+ )}
{/* Compute section */}
<ComputeLineItem
@@ -141,12 +148,9 @@ export const UpcomingInvoice = ({ slug }: UpcomingInvoiceProps) => {
The first project is covered by Compute Credits. Additional projects incur
compute costs starting at <span translate="no">$10</span>/month, independent
of activity. See{' '}
- <Link
- href={`${DOCS_URL}/guides/platform/manage-your-usage/compute`}
- target="_blank"
- >
+ <InlineLink href={`${DOCS_URL}/guides/platform/manage-your-usage/compute`}>
docs
- </Link>
+ </InlineLink>
.
</p>
}
@@ -161,12 +165,11 @@ export const UpcomingInvoice = ({ slug }: UpcomingInvoiceProps) => {
Each Read Replica is a dedicated database. You are charged for its resources:
Compute, Disk Size, provisioned Disk IOPS, provisioned Disk Throughput, and
IPv4. See{' '}
- <Link
+ <InlineLink
href={`${DOCS_URL}/guides/platform/manage-your-usage/read-replicas`}
- target="_blank"
>
docs
- </Link>
+ </InlineLink>
.
</p>
}
@@ -369,6 +372,19 @@ export const UpcomingInvoice = ({ slug }: UpcomingInvoiceProps) => {
</TableCell>
</TableRow>
)}
+
+ {planFeePaidInAdvance && (
+ <TableRow className="border-0 hover:bg-transparent">
+ <TableCell
+ className="pt-2! pb-0! px-0 text-foreground-light text-xs text-right"
+ colSpan={2}
+ >
+ Your {organization?.plan?.name && `${organization.plan.name} `}Plan fee for
+ this period has already been paid. This invoice will only reflect usage
+ charges.
+ </TableCell>
+ </TableRow>
+ )}
</TableFooter>
</Table>
</div>
diff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.ts
index ebd99a5be18..4edc8c4d986 100644
--- a/packages/api-types/types/platform.d.ts
+++ b/packages/api-types/types/platform.d.ts
@@ -5444,6 +5444,33 @@ export interface components {
cloud_provider: 'AWS' | 'FLY' | 'AWS_K8S' | 'AWS_NIMBUS'
custom_supabase_internal_requests?: {
ami: {
+ /**
+ * @description Exact AWS instance type to provision (e.g. `t3.nano`, `t4g.nano`). When omitted the default for `desired_instance_size` is used. Only for internal use; rejected for user-facing requests in production.
+ * @enum {string}
+ */
+ instance_type?:
+ | 't4g.nano'
+ | 't3.nano'
+ | 't3a.nano'
+ | 't4g.micro'
+ | 't4g.small'
+ | 't4g.medium'
+ | 'm6g.medium'
+ | 'm6g.large'
+ | 'm6g.xlarge'
+ | 'm6g.2xlarge'
+ | 'm6g.4xlarge'
+ | 'm6g.8xlarge'
+ | 'm6g.12xlarge'
+ | 'm6g.16xlarge'
+ | 'm8g.24xlarge'
+ | 'c8g.24xlarge'
+ | 'r8g.24xlarge'
+ | 'x8g.24xlarge'
+ | 'm8g.48xlarge'
+ | 'c8g.48xlarge'
+ | 'r8g.48xlarge'
+ | 'x8g.48xlarge'
search_tags?: {
[key: string]: string
}
@@ -9914,6 +9941,7 @@ export interface components {
}
RestorePhysicalBackupBody: {
id: number
+ recovery_time_target?: string
}
RevokeAuthorizedOAuthAppResponse: {
authorized_at?: string
@@ -10390,6 +10418,8 @@ export interface components {
billing_cycle_start: string
currency: string
customer_balance: number
+ /** @enum {string} */
+ fixed_fees_billing_mode: 'in_advance' | 'in_arrears'
lines: {
amount: number
amount_before_discount: number
@@ -15222,7 +15252,6 @@ export interface operations {
OrgAuditLogsController_getAuditLogs: {
parameters: {
query: {
- format?: 'legacy' | 'v2'
/** @description End timestamp */
iso_timestamp_end: string
/** @description Start timestamp */
@@ -19446,7 +19475,6 @@ export interface operations {
UserAuditLogsController_getAuditLogs: {
parameters: {
query: {
- format?: 'legacy' | 'v2'
/** @description End timestamp */
iso_timestamp_end: string
/** @description Start timestamp */