Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): treat ENTERPRISE as admin-managed on the billing plan card (#15103)

Abhimanyu Yadava0a60a20e8a6
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-cards.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-cards.test.tsx
index d9e0cb3f06..69428f23d9 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-cards.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-cards.test.tsx
@@ -708,6 +708,62 @@ describe("YourPlanCard cycle toggle", () => {
await waitFor(() => expect(screen.queryAllByRole("radio").length).toBe(0));
});
+ it("ENTERPRISE account sees the Enterprise label, the managed-by line and a contact link, with no plan controls", async () => {
+ // The backend rejects every self-service change from ENTERPRISE with
+ // 403, so the card must not offer upgrade/downgrade/resume or the
+ // Stripe "Manage subscription" portal — even when a stray schedule is
+ // attached to the account.
+ server.use(
+ jsonHandler("get", "/api/credits/subscription", {
+ tier: "ENTERPRISE",
+ monthly_cost: 0,
+ billing_cycle: "monthly",
+ has_active_stripe_subscription: true,
+ status: "active",
+ pending_tier: "NO_TIER",
+ pending_tier_effective_at: "2026-05-30T00:00:00Z",
+ }),
+ jsonHandler("get", "/api/credits/manage", {
+ url: "https://billing.stripe.com/p/test",
+ }),
+ );
+
+ render(<YourPlanCard />);
+
+ expect(await screen.findByText("Enterprise")).toBeDefined();
+ expect(screen.queryByText("ENTERPRISE")).toBeNull();
+ expect(screen.getByText("Active")).toBeDefined();
+ expect(
+ screen.getByText(/Managed by your AutoGPT account team/i),
+ ).toBeDefined();
+ expect(
+ screen.getByRole("link", { name: /contact us/i }).getAttribute("href"),
+ ).toBe("mailto:[email protected]");
+ expect(screen.queryByText(/\$0\.00/)).toBeNull();
+ expect(screen.queryByRole("button")).toBeNull();
+ });
+
+ it("BASIC account still sees Upgrade to Pro (backend accepts BASIC → PRO)", async () => {
+ server.use(
+ jsonHandler("get", "/api/credits/subscription", {
+ tier: "BASIC",
+ monthly_cost: 0,
+ billing_cycle: "monthly",
+ has_active_stripe_subscription: false,
+ status: "inactive",
+ }),
+ jsonHandler("get", "/api/credits/manage", { url: null }),
+ );
+
+ render(<YourPlanCard />);
+
+ expect(await screen.findByText("Basic")).toBeDefined();
+ expect(
+ screen.getByRole("button", { name: /upgrade to pro/i }),
+ ).toBeDefined();
+ expect(screen.queryByRole("button", { name: /downgrade to/i })).toBeNull();
+ });
+
it("hides the cycle toggle entirely for BASIC tier", async () => {
// BASIC is a reserved internal slot (no Stripe sub, no upgrade target);
// showing a cycle toggle would imply user-manageable billing.
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-hooks.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-hooks.test.tsx
index bcf555aca6..3edcb093fc 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-hooks.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-hooks.test.tsx
@@ -789,6 +789,81 @@ describe("useYourPlanCard", () => {
expect(typeof result.current.onManage).toBe("function");
});
+ it("ENTERPRISE is admin-managed: no upgrade/downgrade/resume and no plan change is ever posted", async () => {
+ let posted = false;
+ server.use(
+ jsonHandler("get", "/api/credits/subscription", {
+ tier: "ENTERPRISE",
+ monthly_cost: 0,
+ billing_cycle: "monthly",
+ has_active_stripe_subscription: true,
+ status: "active",
+ // A stray Stripe schedule must not surface as a pending change.
+ pending_tier: "PRO",
+ pending_tier_effective_at: "2026-05-30T00:00:00Z",
+ }),
+ jsonHandler("get", "/api/credits/manage", {
+ url: "https://billing.stripe.com/p/test",
+ }),
+ http.post("*/api/credits/subscription", () => {
+ posted = true;
+ return HttpResponse.json({ url: null });
+ }),
+ );
+
+ const { result } = renderHook(() => useYourPlanCard(), {
+ wrapper: makeWrapper(),
+ });
+
+ await waitFor(() => expect(result.current.isLoading).toBe(false));
+
+ expect(result.current.plan?.label).toBe("Enterprise");
+ expect(result.current.plan?.isAdminManaged).toBe(true);
+ expect(result.current.plan?.nextTier).toBeNull();
+ expect(result.current.plan?.previousTier).toBeNull();
+ expect(result.current.plan?.isPendingDowngrade).toBe(false);
+ expect(result.current.canUpgrade).toBe(false);
+ expect(result.current.canDowngrade).toBe(false);
+ expect(result.current.canResume).toBe(false);
+ expect(result.current.canManagePortal).toBe(false);
+ expect(result.current.isCycleToggleVisible).toBe(false);
+
+ await act(async () => {
+ result.current.onUpgrade();
+ result.current.onDowngrade();
+ result.current.onResume();
+ });
+
+ expect(result.current.pendingTierUpgrade).toBeNull();
+ expect(result.current.pendingTierDowngrade).toBeNull();
+ expect(posted).toBe(false);
+ });
+
+ it("BASIC keeps PRO as its next tier (backend accepts BASIC → PRO)", async () => {
+ server.use(
+ jsonHandler("get", "/api/credits/subscription", {
+ tier: "BASIC",
+ monthly_cost: 0,
+ billing_cycle: "monthly",
+ has_active_stripe_subscription: false,
+ status: "inactive",
+ }),
+ jsonHandler("get", "/api/credits/manage", { url: null }),
+ );
+
+ const { result } = renderHook(() => useYourPlanCard(), {
+ wrapper: makeWrapper(),
+ });
+
+ await waitFor(() => expect(result.current.isLoading).toBe(false));
+
+ expect(result.current.plan?.label).toBe("Basic");
+ expect(result.current.plan?.isAdminManaged).toBe(false);
+ expect(result.current.plan?.nextTier).toBe("PRO");
+ expect(result.current.canUpgrade).toBe(true);
+ expect(result.current.canDowngrade).toBe(false);
+ });
+
it("falls back to the raw tier string when PLAN_LABEL has no match", async () => {
server.use(
jsonHandler("get", "/api/credits/subscription", {
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/YourPlanCard.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/YourPlanCard.tsx
index 86a84b3c96..df12e14ec5 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/YourPlanCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/YourPlanCard.tsx
@@ -14,7 +14,7 @@ import {
import { CycleToggle } from "./CycleToggle";
import { SwitchCycleDialog } from "./SwitchCycleDialog";
import { SwitchTierDialog } from "./SwitchTierDialog";
-import { useYourPlanCard } from "./useYourPlanCard";
+import { ENTERPRISE_CONTACT_URL, useYourPlanCard } from "./useYourPlanCard";
import { LinkSquare01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/atoms/Icon/Icon";
@@ -111,7 +111,18 @@ export function YourPlanCard({ index = 0 }: Props) {
/>
) : null}
</div>
- {plan.isPaidPlan ? (
+ {plan.isAdminManaged ? (
+ <Text variant="body" as="span" className="text-zinc-700">
+ Managed by your AutoGPT account team.{" "}
+ <a
+ href={ENTERPRISE_CONTACT_URL}
+ className="font-medium text-purple-500 no-underline hover:text-purple-600"
+ >
+ Contact us
+ </a>{" "}
+ for changes.
+ </Text>
+ ) : plan.isPaidPlan ? (
<Text variant="body" as="span" className="text-zinc-700">
{formatCents(plan.monthlyCostCents)}
{plan.billingCycle === "yearly" ? " / year" : " / month"}
@@ -168,7 +179,7 @@ export function YourPlanCard({ index = 0 }: Props) {
Downgrade to {plan.previousTierLabel}
</Button>
) : null}
- {plan.isPaidPlan ? (
+ {plan.isPaidPlan && !plan.isAdminManaged ? (
<Button
variant="secondary"
size="small"
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/useYourPlanCard.ts b/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/useYourPlanCard.ts
index 0b2db15204..ddaf085e36 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/useYourPlanCard.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/useYourPlanCard.ts
@@ -23,11 +23,18 @@ import { formatCents, formatShortDate } from "../../../helpers";
const PLAN_LABEL: Record<string, string> = {
NO_TIER: "No active subscription",
+ BASIC: "Basic",
PRO: "Pro",
MAX: "Max",
BUSINESS: "Team",
+ ENTERPRISE: "Enterprise",
};
+// ENTERPRISE seats are provisioned by an administrator and the backend
+// rejects every self-service change from them with 403, so the card must
+// not offer any plan controls — point these users at the account team.
+export const ENTERPRISE_CONTACT_URL = "mailto:[email protected]";
+
// Team upgrade is contact-sales — open the Tally intake form rather than
// firing a Stripe Checkout from the BUSINESS tier.
export const TEAM_UPGRADE_URL = "https://tally.so/r/2Eb9zj";
@@ -79,6 +86,7 @@ export function useYourPlanCard() {
const effectiveTier = subscription.data?.tier ?? null;
const isPaid = effectiveTier !== null && effectiveTier !== "NO_TIER";
+ const isAdminManaged = effectiveTier === "ENTERPRISE";
const serverCycle: SubscriptionTierRequestBillingCycle =
subscription.data?.billing_cycle === "yearly" ? "yearly" : "monthly";
@@ -104,10 +112,19 @@ export function useYourPlanCard() {
setSelectedCycle(serverCycle);
}, [serverCycle]);
- const nextTierKey = effectiveTier ? getNextTier(effectiveTier) : null;
- const previousTierKey = effectiveTier ? getPreviousTier(effectiveTier) : null;
-
- const pendingTier = subscription.data?.pending_tier ?? null;
+ // ENTERPRISE sits above every self-serve tier, so it has no upgrade target
+ // and no self-serve downgrade (getNextTier would otherwise fall back to
+ // PRO and offer a downgrade labelled "Upgrade").
+ const nextTierKey =
+ effectiveTier && !isAdminManaged ? getNextTier(effectiveTier) : null;
+ const previousTierKey =
+ effectiveTier && !isAdminManaged ? getPreviousTier(effectiveTier) : null;
+
+ // Any Stripe schedule attached to an ENTERPRISE account is admin business;
+ // surfacing it would offer a "Resume" the backend rejects.
+ const pendingTier = isAdminManaged
+ ? null
+ : (subscription.data?.pending_tier ?? null);
const pendingEffectiveAt =
subscription.data?.pending_tier_effective_at ?? null;
const pendingBillingCycle = subscription.data?.pending_billing_cycle ?? null;
@@ -176,6 +193,7 @@ export function useYourPlanCard() {
isPendingDowngrade,
isPendingCycleSwitch,
billingCycle: serverCycle,
+ isAdminManaged,
}
: undefined;
@@ -184,7 +202,7 @@ export function useYourPlanCard() {
// user-manageable cycle to switch — the toggle would be dead UI.
const isCycleToggleVisible =
effectiveTier !== null &&
- effectiveTier !== "ENTERPRISE" &&
+ !isAdminManaged &&
effectiveTier !== "BASIC" &&
effectiveTier !== "NO_TIER";
@@ -520,7 +538,9 @@ export function useYourPlanCard() {
plan,
isLoading: subscription.isLoading,
isUpdatingTier,
- canManagePortal: Boolean(paymentPortal.data),
+ // ENTERPRISE has no Stripe subscription to manage; the Payment method
+ // card still exposes the portal for cards and invoices.
+ canManagePortal: Boolean(paymentPortal.data) && !isAdminManaged,
// Don't offer upgrade alongside Resume — pending cancel/downgrade should
// be released first via resumeSubscription, not stacked with a new tier.
canUpgrade: Boolean(