diff --git a/src/components/admin/users-table.tsx b/src/components/admin/users-table.tsx
index 23e68c5..920c986 100644
--- a/src/components/admin/users-table.tsx
+++ b/src/components/admin/users-table.tsx
@@ -121,7 +121,7 @@ function PlanBadge({ plan }: { plan: Plan | null }) {
if (plan && plan !== 'free') {
return (
- {plan}
+ {PAID_PLANS[plan].name}
)
}
@@ -227,4 +227,4 @@ function RunsGrant({ workspaceId }: { workspaceId: string }) {
)
-}
+}
\ No newline at end of file
diff --git a/src/routes/api.billing.webhook.tsx b/src/routes/api.billing.webhook.tsx
index 7d22497..a926bb7 100644
--- a/src/routes/api.billing.webhook.tsx
+++ b/src/routes/api.billing.webhook.tsx
@@ -102,14 +102,15 @@ async function handleEvent(event: BachsEvent): Promise {
productId: event.data?.product_id,
metadataPlan: event.data?.metadata?.plan,
})
- // The customer paid, so never leave them on free: an unrecognised product
- // falls back to Pro, logged so the product mapping can be fixed.
+ // If no plan is matched, it indicates an unrecognised product configuration.
+ // This should be treated as an error to prevent inconsistent state.
if (!matched) {
- console.warn(
- `[billing] subscription for workspace ${workspaceId} matched no plan; defaulting to pro`,
+ console.error(
+ `[billing] subscription for workspace ${workspaceId} matched no known plan for product ID ${event.data?.product_id} and metadata plan ${event.data?.metadata?.plan}; failing webhook processing.`,
)
+ throw new Error('Unrecognized subscription plan')
}
- const plan = matched ?? 'pro'
+ const plan = matched
await markWorkspacePaid(workspaceId, plan, {
customerId,
subscriptionId: event.data?.subscription_id,
diff --git a/src/routes/pricing.tsx b/src/routes/pricing.tsx
index 552cf82..5a14f24 100644
--- a/src/routes/pricing.tsx
+++ b/src/routes/pricing.tsx
@@ -101,7 +101,7 @@ function PricingPage() {
One-click fix PRs
{plan === 'free' && signedIn ? (
-
+
) : (
{currentPlan === id ? (
-
+
) : currentPlan !== 'free' ? (
You're on {PAID_PLANS[currentPlan].name}
@@ -242,11 +242,11 @@ function PaidPlanCard({
)
}
-function CurrentPlan({ paid = false }: { paid?: boolean }) {
+function CurrentPlan({ paid = false, currentPlan }: { paid?: boolean; currentPlan: Plan }) {
return paid ? (
- Your current plan
+ You're on {PAID_PLANS[currentPlan as PaidPlan].name}
) : (