Skip to content

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

fix: adjust charge breakdown for prorated credits and subtotal calculation (#45075)

Ignacio Dobronich18e21a410b90
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/SubscriptionPlanUpdateDialog.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/SubscriptionPlanUpdateDialog.tsx
index 7cdafc430d7..e6479ed8ba4 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/SubscriptionPlanUpdateDialog.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/SubscriptionPlanUpdateDialog.tsx
@@ -254,34 +254,24 @@ export const SubscriptionPlanUpdateDialog = ({
// Derives the itemized charge breakdown rows shown above "Charge today".
// Example: Pro -> Team upgrade with proration, tax, and credits:
// Team Plan $25.00
- // Unused Time on Pro -$8.33
- // Subtotal $16.67
// Tax (10%) $1.67
+ // Subtotal $26.67
+ // Unused Time on Pro -$8.33
// Credits -$5.00
// ─────────────────────────────
// Charge today $13.34
const breakdownItems = useMemo(() => {
const items: BreakdownItem[] = []
- if (currentPlanId !== 'free' && proratedCredit > 0) {
- items.push({
- type: 'amount',
- label: `Unused Time on ${currentPlanName} Plan`,
- amount: -proratedCredit,
- tooltip:
- 'Your previous plan was charged upfront, so a plan change will prorate any unused time in credits. If the prorated credits exceed the new plan charge, the excessive credits are added to your organization for future use.',
- })
- }
-
if (hasTax && tax) {
- if (taxableAmount !== newPlanCost) {
- items.push({ type: 'amount', label: 'Subtotal', amount: taxableAmount! })
- }
items.push({
type: 'amount',
label: `Tax (${tax.tax_rate_percentage}%)`,
amount: tax.tax_amount,
})
+ if (taxableAmount !== newPlanCost) {
+ items.push({ type: 'amount', label: 'Subtotal', amount: taxableAmount! })
+ }
}
if (taxFailed) {
@@ -291,6 +281,17 @@ export const SubscriptionPlanUpdateDialog = ({
})
}
+ if (currentPlanId !== 'free' && proratedCredit > 0) {
+ items.push({
+ type: 'amount',
+ label: `Unused Time on ${currentPlanName} Plan`,
+ amount: -proratedCredit,
+ tooltip:
+ 'Your previous plan was charged upfront, so a plan change will prorate any unused time in credits. If the prorated credits exceed the new plan charge, the excessive credits are added to your organization for future use.' +
+ (hasTax ? ' Includes proportional tax if applicable.' : ''),
+ })
+ }
+
if (customerBalance > 0) {
items.push({
type: 'amount',