Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: updated the license page based on feedback
=bf0165a718a7
diff --git a/backend/src/ee/routes/v1/license-v2-router.ts b/backend/src/ee/routes/v1/license-v2-router.tsindex c2d0b6538a..961a779937 100644--- a/backend/src/ee/routes/v1/license-v2-router.ts+++ b/backend/src/ee/routes/v1/license-v2-router.ts@@ -168,7 +168,8 @@ const BillingV2OverviewSchema = z.object({entitlements: z.record(BillingV2EntitlementSchema),trialedProductKeys: z.string().array(),onDemandAmount: z.number(),- checkoutFrozen: z.boolean()+ checkoutFrozen: z.boolean(),+ selfServe: z.boolean()});const BillingV2PreviewLineSchema = z.object({@@ -437,10 +438,15 @@ export const registerLicenseV2Router = async (server: FastifyZodProvider) => {schema: {params: z.object({ organizationId: z.string().trim() }),body: z.object({- changes: BillingV2CommitmentChangeSchema.array().min(1).max(20)+ changes: BillingV2CommitmentChangeSchema.array().min(1).max(20),+ productId: z.string().trim()}),response: {- 200: BillingV2MutationResultSchema+ 200: z.object({+ outcome: z.enum(["checkout_created", "subscription_updated"]),+ checkoutUrl: z.string().optional(),+ subscriptionId: z.string().optional()+ })}},onRequest: verifyAuth([AuthMode.JWT]),@@ -448,7 +454,8 @@ export const registerLicenseV2Router = async (server: FastifyZodProvider) => {return server.services.licenseV2.changeCommitments({orgId: req.params.organizationId,actor: buildActor(req.permission),- changes: req.body.changes+ changes: req.body.changes,+ productId: req.body.productId});}});@@ -467,7 +474,7 @@ export const registerLicenseV2Router = async (server: FastifyZodProvider) => {}),response: {200: z.object({- outcome: z.literal("trial_started"),+ outcome: z.enum(["trial_started", "awaiting_card"]),cardSetupUrl: z.string().optional()})}diff --git a/backend/src/ee/services/license-v2/license-v2-service.ts b/backend/src/ee/services/license-v2/license-v2-service.tsindex 4b33ebc0e7..a617afed1b 100644--- a/backend/src/ee/services/license-v2/license-v2-service.ts+++ b/backend/src/ee/services/license-v2/license-v2-service.ts@@ -435,7 +435,7 @@ export const licenseV2ServiceFactory = ({const needsCatalog = Boolean(subscription?.items.length);if (needsCatalog) {try {- const catalog = await licenseClient.getCatalog();+ const catalog = await licenseClient.getCatalog(org.id);catalog?.products.forEach((product) => {catalogProductById.set(product.id, product);product.dimensions.forEach((dimension) => {@@ -777,7 +777,10 @@ export const licenseV2ServiceFactory = ({entitlements,trialedProductKeys,onDemandAmount,- checkoutFrozen: subscription?.capabilities?.checkoutFrozen ?? false+ checkoutFrozen: subscription?.capabilities?.checkoutFrozen ?? false,+ // false for an enterprise-managed org (self-serve mutations 403); default true keeps paygo and+ // older servers unchanged.+ selfServe: subscription?.capabilities?.selfServe ?? true};return { overview };@@ -794,7 +797,7 @@ export const licenseV2ServiceFactory = ({const getCatalog = async ({ orgId, actor }: TGetBillingV2CatalogDTO) => {await ensureBillingRead(orgId, actor);- const catalog = await licenseClient.getCatalog();+ const catalog = await licenseClient.getCatalog(orgId);if (!catalog) {return { products: [] };}@@ -840,7 +843,7 @@ export const licenseV2ServiceFactory = ({}: TBuyBillingV2ProductDTO) => {await ensureManageBilling(orgId, actor);- const catalog = await licenseClient.getCatalog();+ const catalog = await licenseClient.getCatalog(orgId);const product = catalog?.products.find((candidate) => candidate.id === productId);if (!product) {throw new NotFoundError({ message: `Product with ID '${productId}' not found` });@@ -896,7 +899,7 @@ export const licenseV2ServiceFactory = ({const payload: TSubscriptionPreviewPayload = {};if (addProductId) {- const catalog = await licenseClient.getCatalog();+ const catalog = await licenseClient.getCatalog(orgId);const product = catalog?.products.find((candidate) => candidate.id === addProductId);if (!product) {throw new NotFoundError({ message: `Product with ID '${addProductId}' not found` });@@ -941,16 +944,23 @@ export const licenseV2ServiceFactory = ({};};- const changeCommitments = async ({ orgId, actor, changes }: TChangeBillingV2CommitmentDTO) => {+ const changeCommitments = async ({ orgId, actor, changes, productId }: TChangeBillingV2CommitmentDTO) => {await ensureManageBilling(orgId, actor);if (!changes.length) {throw new BadRequestError({ message: "Provide at least one commitment change" });}const result = await licenseClient.changeCommitments(orgId, {+ productId,dimensions: changes.map((change) => ({ dimensionKey: change.dimensionKey, quantity: change.quantity }))});await licenseClient.invalidateEntitlements(orgId);- return { subscriptionId: result.subscriptionId };+ if (result.outcome === "checkout_created") {+ if (!result.checkoutUrl) {+ throw new InternalServerError({ message: "Checkout session did not return a URL" });+ }+ return { outcome: "checkout_created" as const, checkoutUrl: result.checkoutUrl };+ }+ return { outcome: "subscription_updated" as const, subscriptionId: result.subscriptionId };};// Start a plan-scoped self-serve trial. The trial is granted immediately (no upfront charge);diff --git a/backend/src/ee/services/license-v2/license-v2-types.ts b/backend/src/ee/services/license-v2/license-v2-types.tsindex f2e3bb21a0..63b5a24ecf 100644--- a/backend/src/ee/services/license-v2/license-v2-types.ts+++ b/backend/src/ee/services/license-v2/license-v2-types.ts@@ -194,6 +194,7 @@ export type BillingV2Overview = {// Total monthly on-demand overage across all products (dollars), for the summary's on-demand note.onDemandAmount: number;checkoutFrozen: boolean;+ selfServe: boolean;};export type TGetBillingV2OverviewDTO = {@@ -274,11 +275,14 @@ export type TRemoveBillingV2ProductDTO = {// Start / change annual commitments across dimensions in one atomic call. Increase is charged now; a// decrease is rejected by the server unless the dimension's decrease window is open. The change always-// prices at the current server time; a client-supplied proration instant is never accepted.+// prices at the current server time; a client-supplied proration instant is never accepted. productId+// is required: it names the product so the server resolves the trialing plan and creates/attaches the+// subscription when there isn't one yet (a trialing org). Not trialing it → product_not_trialing.export type TChangeBillingV2CommitmentDTO = {orgId: string;actor: OrgServiceActor;changes: BillingV2CommitmentChange[];+ productId: string;};export type TStartBillingV2TrialDTO = {diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.tsindex 88344e314b..c88756aa85 100644--- a/backend/src/ee/services/license/license-service.ts+++ b/backend/src/ee/services/license/license-service.ts@@ -120,6 +120,9 @@ export const licenseServiceFactory = ({envConfig.INTERNAL_REGION);+ const isV1CloudKey = () =>+ instanceType === InstanceType.Cloud && envConfig.LICENSE_SERVER_KEY && envConfig.LICENSE_SERVER_V2_MODE !== "on";+const syncLicenseKeyOnPremFeatures = async (shouldThrow: boolean = false) => {logger.info("Start syncing license key features");try {@@ -314,25 +317,6 @@ export const licenseServiceFactory = ({throw new BadRequestError({ message: "License Server v2 entitlements are unavailable" });}currentPlan = projectV2ToFeatureSet(getDefaultOnPremFeatures(), entitlements);-- // The entitlement projection only carries feature flags, so set the plan slug from the- // subscription tier; otherwise the org-level plan label can't reflect the real tier. Keep- // it non-fatal so a subscription read failure doesn't drop the org to the free fallback.- try {- const subscription = await licenseClient.getSubscription(rootOrgId);- const paidTiers = (subscription?.items ?? [])- .map((item) => item.plan.toLowerCase())- .filter((tier) => tier !== "free");- if (paidTiers.some((tier) => tier.includes("enterprise"))) {- currentPlan.slug = "enterprise";- } else if (paidTiers.some((tier) => tier.includes("advanced"))) {- currentPlan.slug = "advanced";- } else if (paidTiers.length > 0) {- currentPlan.slug = "pro";- }- } catch (error) {- logger.error(error, `getPlan: failed to resolve plan tier from subscription [orgId=${rootOrgId}]`);- }} else {const {data: { currentPlan: v1Plan }@@ -414,7 +398,7 @@ export const licenseServiceFactory = ({};const generateOrgCustomerId = async (orgName: string, email?: string | null) => {- if (instanceType === InstanceType.Cloud && envConfig.LICENSE_SERVER_KEY) {+ if (isV1CloudKey()) {const {data: { customerId }} = await licenseServerCloudApi.request.post<{ customerId: string }>(@@ -445,7 +429,7 @@ export const licenseServiceFactory = ({// report-only-if-changed, so they're harmless.usageMeteringService?.emit(rootOrgId, UserIdentities.key);- if (instanceType === InstanceType.Cloud && envConfig.LICENSE_SERVER_KEY) {+ if (isV1CloudKey()) {const quantity = await licenseDAL.countOfOrgMembers(rootOrgId, tx);const quantityIdentities = await licenseDAL.countOrgUsersAndIdentities(rootOrgId, tx);if (org?.customerId) {diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.tsindex ea8603a56a..22e47f5722 100644--- a/backend/src/keystore/keystore.ts+++ b/backend/src/keystore/keystore.ts@@ -192,7 +192,7 @@ export const KeyStoreTtls = {LicenseCloudPlanInSeconds: 300, // 5 minutesPamDefaultProjectInSeconds: 300, // 5 minutesLicenseEntitlementsInSeconds: 1800, // 30 minutes- LicenseUsageLastReportedInSeconds: 7776000, // 90 days (~3 billing cycles) so orphaned meter keys self-clean+ LicenseUsageLastReportedInSeconds: 604800, // 7 daysAiMcpEndpointOAuthFlowInSeconds: 300, // 5 minutesOauthAuthorizationCodeInSeconds: 600, // 10 minutesAiMcpServerOAuthSessionInSeconds: 600, // 10 minutesdiff --git a/backend/src/services/license-client/dual-read/entitlement-projection.ts b/backend/src/services/license-client/dual-read/entitlement-projection.tsindex 478c62b6b4..064480ca94 100644--- a/backend/src/services/license-client/dual-read/entitlement-projection.ts+++ b/backend/src/services/license-client/dual-read/entitlement-projection.ts@@ -9,6 +9,7 @@ import { FEATURE_MAPPINGS } from "./feature-mapping";// imported from license-fns) to avoid a license-service <-> license-fns import cycle.export const projectV2ToFeatureSet = (base: TFeatureSet, entitlements: TEntitlementsResponse): TFeatureSet => {const plan = JSON.parse(JSON.stringify(base)) as Record<string, unknown> & { rateLimits: Record<string, unknown> };+ plan.slug = entitlements?.slug;FEATURE_MAPPINGS.forEach((mapping) => {if (mapping.v1Field === null) {diff --git a/backend/src/services/license-client/license-client-backends.ts b/backend/src/services/license-client/license-client-backends.tsindex 3687426abe..c2066dd442 100644--- a/backend/src/services/license-client/license-client-backends.ts+++ b/backend/src/services/license-client/license-client-backends.ts@@ -77,7 +77,9 @@ const BILLING_ERROR_MESSAGES: Record<string, string> = {plan_cadence_not_offered: "Your current plan version doesn't offer this billing option.",product_already_held: "You already have this product. Remove it before adding it again.",past_due: "There's an unpaid invoice on your account. Resolve payment before making changes.",- resubscribe_cooldown: "This product was removed recently. Please wait a bit before resubscribing."+ resubscribe_cooldown: "This product was removed recently. Please wait a bit before resubscribing.",+ not_self_serve: "Billing for this organization is managed by our team. Contact sales to make changes.",+ product_not_trialing: "Start this product's trial or activate it before setting an annual commitment."};const throwIfResponseError = async (res: Response): Promise<void> => {@@ -139,8 +141,8 @@ export const licenseServerBackend = (await throwIfResponseError(res);},- fetchCatalog: async (): Promise<TCatalogResponse> => {- const url = new URL(PRODUCTS_PATH, serverUrl);+ fetchCatalog: async (orgId: string): Promise<TCatalogResponse> => {+ const url = new URL(orgScoped(orgId, "/products"), serverUrl);const res = await fetch(url, {method: "GET",headers: { Authorization: `Bearer ${mintServiceToken(signingKey)}` },@@ -286,8 +288,6 @@ export const licenseServerBackend = (return checkoutResultSchema.parse(body);},- // Start a plan-scoped self-serve trial. The wire request/response use snake_case; map to camelCase.- // The trial is granted immediately; cardSetupUrl (when present) is a best-effort card-setup checkout.startTrial: async (orgId: string, payload: TStartTrialPayload): Promise<TTrialResult> => {const url = new URL(orgScoped(orgId, "/billing/trial"), serverUrl);const res = await fetch(url, {@@ -302,7 +302,9 @@ export const licenseServerBackend = (}),redirect: "manual"});- await throwIfResponseError(res);+ if (res.status !== 402) {+ await throwIfResponseError(res);+ }const body: unknown = await res.json();const parsed = trialResultSchema.parse(body);return { outcome: parsed.outcome, cardSetupUrl: parsed.card_setup_url };diff --git a/backend/src/services/license-client/license-client-types.ts b/backend/src/services/license-client/license-client-types.tsindex be7bfef1da..3a8db605de 100644--- a/backend/src/services/license-client/license-client-types.ts+++ b/backend/src/services/license-client/license-client-types.ts@@ -24,6 +24,7 @@ const entitlementProductSchema = z// cloud/self-hosted version skew doesn't break reads.export const entitlementsResponseSchema = z.object({+ slug: z.string().nullish(),features: z.record(z.string(), entitlementFeatureSchema),products: z.array(entitlementProductSchema).default([])})@@ -203,10 +204,11 @@ const subscriptionBillingSchema = zexport const subscriptionResponseSchema = z.object({status: z.string(),- // Mutating billing actions are frozen server-side (DISABLE_CHECKOUT); the client disables controls- // ahead of a 503 rather than discovering it on submit.+ // checkoutFrozen: mutating billing actions are frozen server-side (DISABLE_CHECKOUT); the client+ // disables controls ahead of a 503. selfServe: false for an enterprise-managed org (its mutations+ // 403 with not_self_serve), true for paygo. Defaults true so paygo and older servers are unchanged.capabilities: z- .object({ checkoutFrozen: z.boolean().default(false) })+ .object({ checkoutFrozen: z.boolean().default(false), selfServe: z.boolean().default(true) }).passthrough().nullish(),// Per-line billing: there is no subscription-level cadence/period/total (a subscription can mix@@ -391,7 +393,11 @@ export type TCreatePortalPayload = {// Start / change annual commitments across dimensions (PUT /subscription/commitments), all-or-nothing.// The license server prices at its current time; the app never forwards a client-supplied instant.+// productId is required: it names the product so the server can resolve the trialing plan and+// create/attach the subscription when there isn't one yet (a trialing org) instead of having to infer+// it. Not trialing the named product → product_not_trialing.export type TChangeCommitmentsPayload = {+ productId: string;dimensions: TCommitmentChange[];};@@ -404,13 +410,12 @@ export type TStartTrialPayload = {returnUrl?: string;};-// The trial is always granted immediately (our-side, no Stripe subscription, no upfront charge), so-// outcome is always "trial_started". cardSetupUrl is a best-effort setup-mode Checkout to add a card;-// omitted when there's no customer / the portal isn't configured / the session couldn't open. The-// card never gates the trial — at trial end a worker converts (card on file) or expires to free.+// Card-first trial. "trial_started" (HTTP 200): a card is already on file, the trial is granted now.+// "awaiting_card" (HTTP 402): no card, NOT granted; card_setup_url is a setup-mode Checkout, and+// completing it grants the trial via webhook. Abandoning it grants nothing. Retry is safe.const trialResultSchema = z.object({- outcome: z.literal("trial_started"),+ outcome: z.enum(["trial_started", "awaiting_card"]),card_setup_url: z.string().url()@@ -420,7 +425,7 @@ const trialResultSchema = z.optional()}).passthrough();-export type TTrialResult = { outcome: "trial_started"; cardSetupUrl?: string };+export type TTrialResult = { outcome: "trial_started" | "awaiting_card"; cardSetupUrl?: string };export { trialResultSchema };export type TCancelTrialPayload = {@@ -453,7 +458,9 @@ export type TLicenseClientBackend = {fetchEntitlements: (org: TEntitlementOrg) => Promise<TEntitlementsResponse>;// Ask the license server to recompute/bust its cached entitlements after a license change.refreshEntitlements: (org: TEntitlementOrg) => Promise<void>;- fetchCatalog: () => Promise<TCatalogResponse>;+ // Org-scoped on cloud (the catalog is filtered per calling org). The self-hosted backend ignores the+ // arg and hits its single-tenant /v1/products.+ fetchCatalog: (orgId: string) => Promise<TCatalogResponse>;fetchSubscription: (orgId: string) => Promise<TSubscriptionResponse | null>;fetchCloudPlan: (orgId: string) => Promise<TCloudPlanResponse | null>;fetchBillingProfile: (orgId: string) => Promise<TBillingProfileResponse | null>;diff --git a/backend/src/services/license-client/license-client.ts b/backend/src/services/license-client/license-client.tsindex 83b1f5a9f9..2931af2635 100644--- a/backend/src/services/license-client/license-client.ts+++ b/backend/src/services/license-client/license-client.ts@@ -105,11 +105,11 @@ export const licenseClientFactory = ({ envConfig, keyStore }: TLicenseClientFactawait invalidateEntitlements(org.id);};- const getCatalog = async () => {+ const getCatalog = async (orgId: string) => {if (!backend) {return null;}- return backend.fetchCatalog();+ return backend.fetchCatalog(orgId);};const getSubscription = async (orgId: string) => {diff --git a/frontend/src/hooks/api/billingV2/mutations.tsx b/frontend/src/hooks/api/billingV2/mutations.tsxindex a56b470da1..a193be4e22 100644--- a/frontend/src/hooks/api/billingV2/mutations.tsx+++ b/frontend/src/hooks/api/billingV2/mutations.tsx@@ -106,10 +106,10 @@ export const usePreviewBillingV2Change = () => {export const useChangeBillingV2Commitment = () => {const queryClient = useQueryClient();return useMutation({- mutationFn: async ({ orgId, changes }: TChangeBillingV2CommitmentDTO) => {+ mutationFn: async ({ orgId, changes, productId }: TChangeBillingV2CommitmentDTO) => {const { data } = await apiRequest.put<BillingV2MutationResult>(`/api/v1/organizations/${orgId}/billing/v2/subscription/commitments`,- { changes }+ { changes, productId });return data;diff --git a/frontend/src/hooks/api/billingV2/types.ts b/frontend/src/hooks/api/billingV2/types.tsindex 83c446c971..5437021bf7 100644--- a/frontend/src/hooks/api/billingV2/types.ts+++ b/frontend/src/hooks/api/billingV2/types.ts@@ -189,6 +189,9 @@ export type BillingV2Overview = {trialedProductKeys: string[];// Mutating billing actions are frozen server-side; the UI disables purchase/commit/remove controls.checkoutFrozen: boolean;+ // false for an enterprise-managed org: render the self-serve billing UI but disable its controls+ // (trial/buy/commit/cancel), so the customer is pointed to sales rather than hitting a 403 on submit.+ selfServe: boolean;};export type BillingV2CheckoutResult = {@@ -240,6 +243,10 @@ export type BillingV2Preview = {};export type BillingV2MutationResult = {+ // checkout_created is returned when committing on a trialing org with no card created the+ // subscription and it needs hosted checkout (checkoutUrl); otherwise subscription_updated.+ outcome?: "checkout_created" | "subscription_updated";+ checkoutUrl?: string;subscriptionId?: string;};@@ -269,10 +276,12 @@ export type TRemoveBillingV2ProductDTO = {// Start / change annual commitments across dimensions in one atomic call. An increase is charged now;// a decrease is rejected server-side unless the dimension's window is open. The change always prices-// at the current server time.+// at the current server time. productId is required: it names the product so the server resolves the+// trialing plan and creates/attaches the subscription when there isn't one yet (a trialing org).export type TChangeBillingV2CommitmentDTO = {orgId: string;changes: BillingV2CommitmentChange[];+ productId: string;};export type TStartBillingV2TrialDTO = {@@ -286,11 +295,11 @@ export type TCancelBillingV2TrialDTO = {productId: string;};-// The trial is granted immediately (outcome is always trial_started). cardSetupUrl, when present, is a-// best-effort setup-mode Checkout to add a card; the client redirects to it, else shows a card-required-// banner. The card never gates the trial.+// Card-first trial. trial_started: a card is on file, the trial is granted now. awaiting_card: no card,+// NOT granted; the client redirects to cardSetupUrl (a setup-mode Checkout) and the trial is granted by+// webhook on completion.export type BillingV2TrialResult = {- outcome: "trial_started";+ outcome: "trial_started" | "awaiting_card";cardSetupUrl?: string;};diff --git a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsxindex e1f6259819..765ead1d3a 100644--- a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx+++ b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx@@ -182,6 +182,7 @@ export const BillingV2Page = () => {returnPath={window.location.pathname}renewsOn={overview?.entitlements[flow.prodId]?.renewsOn ?? null}trialUsed={overview?.trialedProductKeys.includes(flow.prodId) ?? false}+ selfServe={overview?.selfServe ?? true}onClose={close}onRemove={setRemoveProdId}onContact={() => {diff --git a/frontend/src/pages/organization/BillingV2Page/components/ActivateView.tsx b/frontend/src/pages/organization/BillingV2Page/components/ActivateView.tsxindex 3650284aa2..43c57cdec2 100644--- a/frontend/src/pages/organization/BillingV2Page/components/ActivateView.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/ActivateView.tsx@@ -25,6 +25,12 @@ type Props = {hasActiveSubscription: boolean;returnPath: string;renewsOn: string | null;+ // false for an enterprise-managed org: the activate button is disabled (a mutation would 403).+ selfServe: boolean;+ // This plan offers an unused self-serve trial. In the monthly cadence the primary CTA becomes+ // "Start free trial" (which opens the confirmation dialog) instead of a paid activation.+ trialAvailable: boolean;+ onStartTrial: () => void;onBack: () => void;onDone: () => void;};@@ -82,6 +88,9 @@ export const ActivateView = ({hasActiveSubscription,returnPath,renewsOn,+ selfServe,+ trialAvailable,+ onStartTrial,onBack,onDone}: Props) => {@@ -102,6 +111,9 @@ export const ActivateView = ({);const [acknowledged, setAcknowledged] = useState(false);const needsCommitmentAck = cadence === "annual" && committable.length > 0;+ // A trial is monthly/usage-based, so it only applies to the monthly cadence. Switching to yearly is+ // a paid annual purchase, not a trial, so the CTA flips back to Pay.+ const trialFlow = trialAvailable && cadence === "monthly";const preview = usePreviewBillingV2Change();const buyProduct = useBuyBillingV2Product();@@ -148,8 +160,10 @@ export const ActivateView = ({// changes it settles); a first purchase goes through Stripe Checkout, which collects the whole first// invoice up front (nextInvoiceTotal) — for a yearly commitment that is the full annual amount, not// the $0 prorationAmount a first purchase reports.+ // A trial collects nothing today (the card, if any, is only set up), so due-today is 0 regardless of+ // the previewed purchase amount.let dueToday = 0;- if (preview.data) {+ if (!trialFlow && preview.data) {dueToday = hasActiveSubscription? Math.max(preview.data.totalDueNow, 0): preview.data.nextInvoiceTotal;@@ -163,14 +177,19 @@ export const ActivateView = ({const pending = buyProduct.isPending;let chargedNote = "Calculating…";- if (!isCalculating) {+ if (trialFlow) {+ chargedNote = "Free during your trial";+ } else if (!isCalculating) {chargedNote = hasActiveSubscription? "Prorated onto your shared billing date": "Due today at checkout";}- // The CTA waits until the preview has priced the current selection, and an annual commitment also- // requires the customer to acknowledge the commitment terms.- const activateDisabled = pending || isCalculating || (needsCommitmentAck && !acknowledged);+ // The paid CTA waits until the preview has priced the current selection, and an annual commitment+ // also requires the customer to acknowledge the terms. The trial CTA has nothing to price, so it+ // only waits on selfServe. An enterprise-managed org (selfServe false) can never submit either.+ const primaryDisabled = trialFlow+ ? !selfServe+ : !selfServe || pending || isCalculating || (needsCommitmentAck && !acknowledged);// Savings badge on the yearly option: how much cheaper the annual rate is vs paying monthly.const savingsPct = useMemo(() => {@@ -211,6 +230,20 @@ export const ActivateView = ({}};+ let primaryLabel = "Start a free trial";+ if (!trialFlow) {+ primaryLabel = isCalculating+ ? "Activate"+ : `Activate · pay ${fmtMoney(dueToday, dueToday ? 2 : 0)} today`;+ }++ let recurringNote: string | undefined;+ if (trialFlow) {+ recurringNote = "Billed monthly after your trial ends";+ } else if (renewsOn) {+ recurringNote = `Billed on ${renewsOn}`;+ }+return (<><SheetHeader className="flex-row items-center gap-3.5 border-b pr-12">@@ -223,7 +256,7 @@ export const ActivateView = ({</div></SheetHeader>- <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-5">+ <div className="flex flex-col gap-4 overflow-y-auto p-5">{supportsMonthly && supportsAnnual && (<div className="flex flex-col gap-2"><span className="text-sm font-medium text-foreground">Billing cadence</span>@@ -261,7 +294,7 @@ export const ActivateView = ({{dim.label} · committed for the year</div><div className="mt-0.5 text-xs text-muted">- {fmtMoney(dim.annual)} / {dim.noun} / yr committed+ {fmtMoney(dim.annual / 12, 2)} / {dim.noun} / mo · billed annually</div></div><Stepper@@ -284,27 +317,28 @@ export const ActivateView = ({{plan.feature && <div className="mt-0.5 text-xs text-muted">{plan.feature}</div>}</div></div>- <span className="shrink-0 text-sm font-semibold text-foreground tabular-nums">- {fmtMoney(localRecurring)} / {period}- </span>+ <div className="flex shrink-0 flex-col items-end">+ <span className="text-sm font-semibold text-foreground tabular-nums">+ {fmtMoney(cadence === "annual" ? localRecurring / 12 : localRecurring)} / mo+ </span>+ {cadence === "annual" && (+ <span className="text-[11px] text-muted">billed annually</span>+ )}+ </div></div>)}- {needsCommitmentAck && (- <CommitmentTerms acknowledged={acknowledged} onAcknowledgedChange={setAcknowledged} />- )}-<CostSummary><CostSummaryRow- label="Charged today"+ label={trialFlow ? "Due today" : "Charged today"}note={chargedNote}value={fmtMoney(dueToday, dueToday ? 2 : 0)}- isCalculating={isCalculating}+ isCalculating={!trialFlow && isCalculating}valueClassName="text-base"/><CostSummaryRowlabel={cadence === "annual" ? "Annual commitment" : "Monthly total"}- note={renewsOn ? `Billed on ${renewsOn}` : undefined}+ note={recurringNote}value={`${fmtMoney(recurring)} / ${period}`}isCalculating={isCalculating}/>@@ -317,6 +351,10 @@ export const ActivateView = ({totalDueNow={preview.data?.totalDueNow ?? 0}/>)}++ {needsCommitmentAck && (+ <CommitmentTerms acknowledged={acknowledged} onAcknowledgedChange={setAcknowledged} />+ )}</div><SheetFooter className="flex-row justify-between border-t">@@ -326,13 +364,11 @@ export const ActivateView = ({</Button><Buttonvariant="org"- onClick={handleActivate}- isDisabled={activateDisabled}+ onClick={trialFlow ? onStartTrial : handleActivate}+ isDisabled={primaryDisabled}isPending={pending}>- {isCalculating- ? "Activate"- : `Activate · pay ${fmtMoney(dueToday, dueToday ? 2 : 0)} today`}+ {primaryLabel}</Button></SheetFooter></>diff --git a/frontend/src/pages/organization/BillingV2Page/components/CommitmentTerms.tsx b/frontend/src/pages/organization/BillingV2Page/components/CommitmentTerms.tsxindex 4b08fde0df..7f68a7b4e3 100644--- a/frontend/src/pages/organization/BillingV2Page/components/CommitmentTerms.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/CommitmentTerms.tsx@@ -1,57 +1,23 @@-import { TriangleAlert } from "lucide-react";--import { Alert, AlertDescription, AlertTitle, Checkbox } from "@app/components/v3";+import { Checkbox } from "@app/components/v3";type Props = {acknowledged: boolean;onAcknowledgedChange: (value: boolean) => void;};-// Consequence-forward confirmation shown before an annual commitment is purchased or increased. An-// annual commitment is paid upfront for the whole cycle, is non-cancellable, and cannot be reduced-// until renewal, so the customer must explicitly acknowledge the terms before Confirm unlocks. The-// copy is deliberately plain so the commitment they are making is unambiguous.+// Single acknowledgment gate shown before an annual commitment is purchased or increased. The+// commitment is paid upfront, non-cancellable, and cannot be reduced until renewal, so Confirm stays+// locked until the customer checks this.export const CommitmentTerms = ({ acknowledged, onAcknowledgedChange }: Props) => (- <Alert variant="warning">- <TriangleAlert />- <AlertTitle>Review your annual commitment</AlertTitle>- <AlertDescription className="flex flex-col gap-2 text-foreground">- <span>- An annual commitment locks in your rate for the full billing year. Please read this before- you confirm:- </span>- <ul className="flex list-disc flex-col gap-1 pl-4 text-muted">- <li>- <span className="font-medium text-foreground">Paid upfront.</span> You are billed today- for the entire year's committed units, not month by month.- </li>- <li>- <span className="font-medium text-foreground">Increase any time.</span> You can raise your- commitment mid cycle; the added units are prorated and charged immediately.- </li>- <li>- <span className="font-medium text-foreground">No reductions mid cycle.</span> Committed- units cannot be lowered until the final window before your renewal.- </li>- <li>- <span className="font-medium text-foreground">Not cancellable.</span> The commitment runs- to the end of the billing cycle and cannot be cancelled early.- </li>- </ul>- <span>Usage above your commitment is billed monthly at the on-demand rate.</span>- <div className="mt-1 flex items-start gap-2.5">- <Checkbox- id="commitment-ack"- variant="warning"- isChecked={acknowledged}- onCheckedChange={(value) => onAcknowledgedChange(value === true)}- className="mt-0.5"- />- <span className="text-xs">- I understand this annual commitment is paid upfront, is not cancellable, and cannot be- reduced until my renewal.- </span>- </div>- </AlertDescription>- </Alert>+ <div className="flex items-start gap-2.5">+ <Checkbox+ id="commitment-ack"+ isChecked={acknowledged}+ onCheckedChange={(value) => onAcknowledgedChange(value === true)}+ />+ <span className="text-xs text-muted">+ I agree to a 12-month term, billed today and non-refundable. The plan can be increased at any+ time; reductions take effect at renewal.+ </span>+ </div>);diff --git a/frontend/src/pages/organization/BillingV2Page/components/CommitmentView.tsx b/frontend/src/pages/organization/BillingV2Page/components/CommitmentView.tsxindex d0a0b84811..1d8e339b2f 100644--- a/frontend/src/pages/organization/BillingV2Page/components/CommitmentView.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/CommitmentView.tsx@@ -28,6 +28,7 @@ type Props = {prod: BillingV2CatalogProduct;entitlement: BillingV2Entitlement;renewsOn: string | null;+ selfServe: boolean;onBack: () => void;onDone: () => void;};@@ -35,7 +36,15 @@ type Props = {// Change the prepaid annual commitment for a product's per_resource dimensions. Steppers set the new// committed quantity per dimension; the preview endpoint (commitmentChanges) prices the change and the// apply endpoint commits it. Usage above the commitment is billed monthly on-demand.-export const CommitmentView = ({ orgId, prod, entitlement, renewsOn, onBack, onDone }: Props) => {+export const CommitmentView = ({+ orgId,+ prod,+ entitlement,+ renewsOn,+ selfServe,+ onBack,+ onDone+}: Props) => {// Dimensions this sheet manages: commit-eligible per the subscription read's per-dimension// commitAvailable (this customer's pinned plan version, NOT the catalog, so a later catalog price// never lights up commit for a grandfathered customer), OR already carrying a commitment even if it@@ -128,8 +137,6 @@ export const CommitmentView = ({ orgId, prod, entitlement, renewsOn, onBack, onD(sum, dim) => sum + Math.max(0, dim.used - quantities[dim.key]) * (dim.onDemandRate ?? 0),0);- // Applying is invoice-now, so the card is charged totalDueNow (this change + any earlier unbilled- // mid-cycle changes), not just this change's proration. Disclose the split when there are extras.const chargedToday = hasChanges ? Math.max(preview.data?.totalDueNow ?? 0, 0) : 0;const additionalCharges = preview.data?.additionalCharges ?? 0;const showChargeBreakdown = hasChanges && previewFresh && additionalCharges !== 0;@@ -142,14 +149,16 @@ export const CommitmentView = ({ orgId, prod, entitlement, renewsOn, onBack, onD// An increase raises the prepaid annual total; that (and starting a commitment from zero) is what// needs the upfront-commitment acknowledgment.const isIncreasing = newAnnual > currentAnnual;- const canConfirm = hasChanges && previewFresh && (!isIncreasing || acknowledged);+ // An enterprise-managed org (selfServe false) can never submit; the button stays disabled.+ const canConfirm = selfServe && hasChanges && previewFresh && (!isIncreasing || acknowledged);const handleConfirm = async () => {try {- await applyCommitment.mutateAsync({- orgId,- changes- });+ const result = await applyCommitment.mutateAsync({ orgId, changes, productId: prod.id });+ if (result.checkoutUrl) {+ window.location.href = result.checkoutUrl;+ return;+ }createNotification({type: "success",text: `${prod.name} commitment updated. It may take a moment to update here.`@@ -200,7 +209,7 @@ export const CommitmentView = ({ orgId, prod, entitlement, renewsOn, onBack, onD</div></SheetHeader>- <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-5">+ <div className="flex flex-col gap-4 overflow-y-auto p-5">{committable.map((dim) => {const onDemandQty = Math.max(0, dim.used - quantities[dim.key]);// Increase-only: the stepper cannot go below the current committed quantity unless the@@ -247,9 +256,7 @@ export const CommitmentView = ({ orgId, prod, entitlement, renewsOn, onBack, onD);})}- {isIncreasing ? (- <CommitmentTerms acknowledged={acknowledged} onAcknowledgedChange={setAcknowledged} />- ) : (+ {!isIncreasing && (<Alert variant="info"><InfoIcon /><AlertDescription className="text-foreground">@@ -261,26 +268,28 @@ export const CommitmentView = ({ orgId, prod, entitlement, renewsOn, onBack, onD</Alert>)}- <CostSummary>- <CostSummaryRow- label="Charged today"- note={chargedNote}- value={fmtMoney(chargedToday, chargedToday ? 2 : 0)}- isCalculating={isCalculating}- valueClassName="text-base"- />- <CostSummaryRow- label="New annual commitment"- note={annualDelta ?? annualNote}- value={`${fmtMoney(newAnnual)} / year`}- />- <CostSummaryRow- label="On-demand after change"- note={onDemandDelta ?? "Billed monthly for usage above your commitment"}- value={`${fmtMoney(newOnDemand)} / mo`}- valueClassName={newOnDemand > 0 ? "text-warning/90" : "text-muted"}- />- </CostSummary>+ <div className="flex-1">+ <CostSummary>+ <CostSummaryRow+ label="Charged today"+ note={chargedNote}+ value={fmtMoney(chargedToday, chargedToday ? 2 : 0)}+ isCalculating={isCalculating}+ valueClassName="text-base"+ />+ <CostSummaryRow+ label="New annual commitment"+ note={annualDelta ?? annualNote}+ value={`${fmtMoney(newAnnual)} / year`}+ />+ <CostSummaryRow+ label="On-demand after change"+ note={onDemandDelta ?? "Billed monthly for usage above your commitment"}+ value={`${fmtMoney(newOnDemand)} / mo`}+ valueClassName={newOnDemand > 0 ? "text-warning/90" : "text-muted"}+ />+ </CostSummary>+ </div>{showChargeBreakdown && (<ChargeBreakdown@@ -289,6 +298,10 @@ export const CommitmentView = ({ orgId, prod, entitlement, renewsOn, onBack, onDtotalDueNow={preview.data?.totalDueNow ?? 0}/>)}++ {isIncreasing && (+ <CommitmentTerms acknowledged={acknowledged} onAcknowledgedChange={setAcknowledged} />+ )}</div><SheetFooter className="flex-row justify-between border-t">diff --git a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsxindex dfa32565d4..46268f5d6e 100644--- a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx@@ -56,7 +56,7 @@ export const Overview = ({);}- const { mode, checkoutFrozen } = overview;+ const { mode, checkoutFrozen, selfServe } = overview;const isManaged = mode === "managed";// Managed plans and read-only billing roles cannot mutate the subscription. A frozen checkout// (server DISABLE_CHECKOUT) disables every mutation path too, so treat it as read-only for the@@ -75,10 +75,25 @@ export const Overview = ({</Alert>) : null;+ // An enterprise-managed org (billing_method enterprise_*) sees the surface but self-serve is off; the+ // per-product controls render disabled and this points them to sales. Distinct from checkoutFrozen.+ const enterpriseNotice =+ !selfServe && !isManaged ? (+ <Alert variant="info">+ <TriangleAlert />+ <AlertTitle>Billing is managed by our team</AlertTitle>+ <AlertDescription>+ Your organization is on a custom agreement, so self-serve changes are disabled. Contact+ sales to adjust products, commitments, or your subscription.+ </AlertDescription>+ </Alert>+ ) : null;+if (subState === "no-subscription") {return (<div className="flex flex-col gap-4">{frozenNotice}+ {enterpriseNotice}<Bannermode={mode}subState={subState}@@ -103,6 +118,7 @@ export const Overview = ({return (<div className="flex flex-col gap-4">{frozenNotice}+ {enterpriseNotice}<Bannermode={mode}subState={subState}diff --git a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsxindex d42b656ee9..c98a6cfc8a 100644--- a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx@@ -1,8 +1,18 @@import { useState } from "react";-import { ArrowRight, CalendarX2Icon, Check, EditIcon, PlusIcon, Sparkles } from "lucide-react";+import {+ ArrowRight,+ CalendarX2Icon,+ Check,+ EditIcon,+ Info,+ PlusIcon,+ Sparkles+} from "lucide-react";import { createNotification } from "@app/components/notifications";import {+ Alert,+ AlertDescription,AlertDialog,AlertDialogAction,AlertDialogCancel,@@ -12,6 +22,7 @@ import {AlertDialogHeader,AlertDialogMedia,AlertDialogTitle,+ AlertTitle,Badge,Button,Sheet,@@ -20,6 +31,7 @@ import {SheetFooter,SheetHeader,SheetTitle,+ Switch,Table,TableBody,TableCell,@@ -57,9 +69,42 @@ import { ActiveBadge, DimensionMeter, ProductIcon } from "./shared";// prefix/metered carry the usage-based framing for metered dims; absent for per_unit and base prices.type PriceLine = { amount: string; unit: string; prefix?: string; metered?: boolean };-const dimPriceLine = (dim: BillingV2Dim, cadence: BillingV2Cadence, unit: string): PriceLine => {+// The plan's headline price for a cadence: a base fee, else the first priced dimension's rate.+const planHeadlinePrice = (plan: BillingV2Plan, cadence: BillingV2Cadence): number => {+ if (plan.base) {+ return unitPrice(plan.base, cadence);+ }+ const dim = plan.dims.find((d) => unitPrice(d, cadence) > 0);+ return dim ? unitPrice(dim, cadence) : 0;+};++// How much cheaper the annual rate is than paying monthly for a year (0 when either is missing).+const annualSavingsPct = (plan: BillingV2Plan): number => {+ const monthly = planHeadlinePrice(plan, "monthly");+ const annual = planHeadlinePrice(plan, "annual");+ if (monthly <= 0 || annual <= 0) {+ return 0;+ }+ const pct = Math.round((1 - annual / (monthly * 12)) * 100);+ return pct > 0 ? pct : 0;+};++const dimPriceLine = (+ dim: BillingV2Dim,+ cadence: BillingV2Cadence,+ variant: "headline" | "usage"+): PriceLine => {const metered = isMeteredCadence(dim, cadence);- const line: PriceLine = { amount: fmtMoney(unitPrice(dim, cadence), 2), unit, metered };+ // A yearly commitment is always divisible by 12, so a per_resource annual price is shown as its+ // per-month equivalent (÷12); metered rates are usage-based consumption prices, shown as-is. The+ // card's cadence toggle is what tells the customer this is billed annually.+ const perMonth = cadence === "annual" && !metered;+ const amount = perMonth ? unitPrice(dim, cadence) / 12 : unitPrice(dim, cadence);+ const unit =+ variant === "headline"+ ? `/ ${dim.noun} / ${perMonth ? "month" : cadenceWord(cadence)}`+ : `per ${dim.noun} / ${perMonth ? "mo" : cadenceWordShort(cadence)}`;+ const line: PriceLine = { amount: fmtMoney(amount, 2), unit, metered };if (metered && dim.included > 0) {line.prefix = `First ${dim.included.toLocaleString()} ${pluralizeUnit(dim.noun)} included, then`;}@@ -94,12 +139,18 @@ const PlanPricing = ({ plan, cadence }: { plan: BillingV2Plan; cadence: BillingV? cadence: ((["monthly", "annual"] as const).find(pricesCadence) ?? cadence);+ // A yearly base fee is shown as its per-month equivalent (÷12), the same treatment the per_resource+ // dims get; the card's cadence toggle communicates that it is billed annually.+ const annual = cad === "annual";let headline: PriceLine | null = plan.base- ? { amount: fmtMoney(unitPrice(plan.base, cad)), unit: `/ ${cadenceWord(cad)}` }+ ? {+ amount: fmtMoney(annual ? unitPrice(plan.base, cad) / 12 : unitPrice(plan.base, cad)),+ unit: annual ? "/ month" : `/ ${cadenceWord(cad)}`+ }: null;let usageDims = dims;if (!headline && dims.length > 0) {- headline = dimPriceLine(dims[0], cad, `/ ${dims[0].noun} / ${cadenceWord(cad)}`);+ headline = dimPriceLine(dims[0], cad, "headline");usageDims = dims.slice(1);}@@ -109,14 +160,14 @@ const PlanPricing = ({ plan, cadence }: { plan: BillingV2Plan; cadence: BillingVconst usageLines = usageDims.map((dim) => ({key: dim.key,- line: dimPriceLine(dim, cad, `per ${dim.noun} / ${cadenceWordShort(cad)}`)+ line: dimPriceLine(dim, cad, "usage")}));return (- <div className="flex flex-col gap-3.5">+ <div className="flex flex-col gap-3"><PriceLineView line={headline} headline />{usageLines.length > 0 && (- <div className="flex flex-col gap-2 border-t border-border pt-3.5">+ <div className="flex flex-col gap-2 border-t border-border pt-3"><span className="text-[10px] font-medium tracking-wide text-muted uppercase">Plus per-unit usage</span>@@ -139,21 +190,6 @@ const renderCompareCell = (value: string | boolean | number | undefined) => {return value;};-const PlanBadge = ({ plan, isCurrent }: { plan: BillingV2Plan; isCurrent: boolean }) => {- if (isCurrent) {- return (- <Badge variant="success">- <Check className="text-success" />- Current plan- </Badge>- );- }- if (plan.salesLed) {- return <Badge variant="info">Sales-led</Badge>;- }- return <Badge variant="info">Self-serve</Badge>;-};-type PlanCardProps = {plan: BillingV2Plan;cadence: BillingV2Cadence;@@ -164,8 +200,10 @@ type PlanCardProps = {canChangeCommitment: boolean;// Whether a commitment already exists, so the CTA reads "Change" vs "Set" commitment.hasCommitment: boolean;+ // false for an enterprise-managed org: self-serve CTAs (activate/trial/commit) render disabled; the+ // sales-led "Contact sales" CTA stays enabled.+ selfServe: boolean;onActivate: (planTier: string) => void;- onStartTrial: (planTier: string) => void;onChangeCommitment: () => void;onContact: () => void;};@@ -178,8 +216,8 @@ const PlanCard = ({trialUsed,canChangeCommitment,hasCommitment,+ selfServe,onActivate,- onStartTrial,onChangeCommitment,onContact}: PlanCardProps) => {@@ -188,10 +226,24 @@ const PlanCard = ({// hasn't used its one-time trial for this product yet.const offersTrial = plan.selfServe && plan.trialable && !entitled && !trialUsed;+ // Each card carries its own billing-cadence toggle. It defaults to the passed cadence (annual for a+ // new product, so the discounted per-month rate leads), clamped to what the plan actually prices.+ const supportsAnnual =+ plan.dims.some((d) => d.annual > 0) || Boolean(plan.base && plan.base.annual > 0);+ const supportsMonthly =+ plan.dims.some((d) => d.monthly > 0) || Boolean(plan.base && plan.base.monthly > 0);+ const [cardCadence, setCardCadence] = useState<BillingV2Cadence>(() => {+ if (cadence === "annual" && supportsAnnual) return "annual";+ if (cadence === "monthly" && supportsMonthly) return "monthly";+ return supportsAnnual ? "annual" : "monthly";+ });+ const showCadenceToggle = supportsMonthly && supportsAnnual;+ const savingsPct = annualSavingsPct(plan);+let cta = null;if (plan.salesLed && !isCurrent) {cta = (- <Button variant="org" size="sm" className="mt-auto self-start" onClick={onContact}>+ <Button variant="org" size="sm" className="w-full justify-center" onClick={onContact}>Contact sales<ArrowRight /></Button>@@ -201,7 +253,8 @@ const PlanCard = ({<Buttonvariant="success"size="sm"- className="mt-auto self-start"+ className="w-full justify-center"+ isDisabled={!selfServe}onClick={onChangeCommitment}>{hasCommitment ? "Change commitment" : "Set commitment"}@@ -209,20 +262,25 @@ const PlanCard = ({</Button>);} else if (plan.selfServe && !entitled) {+ // Both trial and paid activation open the purchase sheet; it hosts the actual Start-trial / Pay+ // action (and, for a trial, the confirmation dialog). The label just sets expectations here.cta = offersTrial ? (<Buttonvariant="org"size="sm"- className="mt-auto self-start"- onClick={() => onStartTrial(plan.tier)}+ className="w-full justify-center"+ isDisabled={!selfServe}+ onClick={() => onActivate(plan.tier)}>- Start free trial+ <Sparkles />+ Start a free trial</Button>) : (<Buttonvariant="org"size="sm"- className="mt-auto self-start"+ className="w-full justify-center"+ isDisabled={!selfServe}onClick={() => onActivate(plan.tier)}><PlusIcon />@@ -233,23 +291,55 @@ const PlanCard = ({return (<div- className={`flex flex-col gap-3.5 rounded-xl border p-[18px] ${+ className={`flex flex-col gap-5 rounded-xl border p-5 ${isCurrent ? "border-success/40 bg-success/5" : "border-border bg-card"}`}>- <div className="flex items-center justify-between gap-2">- <span className="text-[15px] font-medium text-foreground">{plan.name}</span>- <PlanBadge plan={plan} isCurrent={isCurrent} />- </div>- {isCustom ? (- <div className="flex items-baseline">- <span className="text-2xl font-medium text-foreground">Custom</span>+ <div className="flex flex-col gap-1.5">+ <div className="flex items-center gap-2">+ <span className="text-[15px] font-medium text-foreground">{plan.name}</span>+ {isCurrent && (+ <Badge variant="success">+ <Check className="text-success" />+ Current plan+ </Badge>+ )}</div>- ) : (- <PlanPricing plan={plan} cadence={cadence} />- )}- {plan.feature && <div className="text-xs text-accent">{plan.feature}</div>}+ {/* Reserve two lines so the CTA (and everything below it) lines up across the card row. */}+ <p className="min-h-10 text-sm leading-5 text-muted">{plan.feature}</p>+ </div>+{cta}++ {/* Cadence + price sit at the bottom so they align across cards of unequal description length. */}+ <div className="mt-auto flex flex-col gap-2.5">+ {!isCustom && (showCadenceToggle || cardCadence === "annual") && (+ <div className="flex items-center gap-2">+ {showCadenceToggle && (+ <Switch+ variant="org"+ size="sm"+ className="shrink-0"+ checked={cardCadence === "annual"}+ onCheckedChange={(value) => setCardCadence(value ? "annual" : "monthly")}+ />+ )}+ <span className="text-xs font-medium whitespace-nowrap text-foreground">+ {cardCadence === "annual" ? "Billed annually" : "Billed monthly"}+ </span>+ {cardCadence === "annual" && savingsPct > 0 && (+ <Badge variant="success" className="shrink-0">+ Save {savingsPct}%+ </Badge>+ )}+ </div>+ )}+ {isCustom ? (+ <span className="text-2xl font-medium text-foreground">Custom</span>+ ) : (+ <PlanPricing plan={plan} cadence={cardCadence} />+ )}+ </div></div>);};@@ -354,6 +444,9 @@ type ProductSheetProps = {renewsOn: string | null;// This product's one-per-product trial is already used up (backend-computed from trial history).trialUsed: boolean;+ // capabilities.selfServe: false for an enterprise-managed org. Self-serve CTAs render disabled and a+ // notice points to sales; the sales-led "Contact sales" path stays available.+ selfServe: boolean;onClose: () => void;onRemove: (prodId: string) => void;onContact: (prod: BillingV2CatalogProduct) => void;@@ -370,6 +463,7 @@ export const ProductSheet = ({returnPath,renewsOn,trialUsed,+ selfServe,onClose,onRemove,onContact@@ -393,13 +487,13 @@ export const ProductSheet = ({// A trialing product is canceled (trial → free), not removed like a paid product line.const isTrialing = Boolean(entitlement?.isTrialing);const selfServePlan = prod.plans.find((plan) => plan.selfServe && !plan.salesLed);- // The active product's plan-card price renders in its billing cadence. A new product defaults to- // yearly, EXCEPT when a self-serve trial is on offer: a trial is monthly/usage-based, so show monthly- // there. PlanPricing still falls back to monthly for a monthly-only plan.const trialAvailable =!entitled && !trialUsed && prod.plans.some((plan) => plan.selfServe && plan.trialable);- const displayCadence: BillingV2Cadence =- entitlement?.cadence ?? (trialAvailable ? "monthly" : "annual");+ // The plan-card price always leads with the best (annual) rate shown as a per-month figure (÷12, see+ // PlanPricing) with a "billed annually" note, even for a trialable plan. An entitled product shows+ // its own cadence. PlanPricing falls back to monthly for a monthly-only plan. The trial's+ // monthly-first default lives in the purchase sheet (ActivateView), not on this card.+ const displayCadence: BillingV2Cadence = entitlement?.cadence ?? "annual";// Offer the commitment flow when the org already has a commitment (to change it) OR its pinned plan// version lets it commit a dimension it hasn't set yet (start from zero, e.g. a monthly subscriber// committing annually). Uses the SAME predicate the commitment view filters on (dimCommitManageable),@@ -432,15 +526,16 @@ export const ProductSheet = ({productId: prod.id,plan: trialConfirmTier});- // The trial is already active. Redirect to the card-setup checkout when the server returns one so- // it can convert at trial end; otherwise nudge the user to add a card before then.- if (result.cardSetupUrl) {+ // Card-first: awaiting_card means no card is on file and the trial is NOT granted yet. Send the+ // customer to the card-setup checkout; completing it grants the trial via webhook.+ if (result.outcome === "awaiting_card" && result.cardSetupUrl) {window.location.href = result.cardSetupUrl;return;}+ // trial_started: a card is on file and the trial is active now.createNotification({type: "success",- text: `Your ${prod.name} trial has started. Add a card before it ends to keep the product.`+ text: `Your ${prod.name} trial has started.`});onClose();} catch {@@ -477,7 +572,7 @@ export const ProductSheet = ({}}}>- <SheetContent side="right" className="flex w-full flex-col p-0 sm:max-w-3xl">+ <SheetContent side="right" className="flex w-full flex-col p-0 sm:max-w-4xl">{view === "activate" && activatePlanObj && (<ActivateVieworgId={orgId}@@ -486,6 +581,13 @@ export const ProductSheet = ({hasActiveSubscription={hasActiveSubscription}returnPath={returnPath}renewsOn={renewsOn}+ selfServe={selfServe}+ // A trial is offered for this plan when the product's trial is unused and the plan itself+ // is self-serve + trialable. ActivateView shows Start-trial vs Pay off this.+ trialAvailable={+ trialAvailable && activatePlanObj.selfServe && activatePlanObj.trialable+ }+ onStartTrial={() => setTrialConfirmTier(activatePlanObj.tier)}onBack={() => setView("plans")}onDone={onClose}/>@@ -497,6 +599,7 @@ export const ProductSheet = ({prod={prod}entitlement={entitlement}renewsOn={renewsOn}+ selfServe={selfServe}onBack={() => setView("plans")}onDone={onClose}/>@@ -521,6 +624,17 @@ export const ProductSheet = ({<CurrentUsageCard entitlement={entitlement} color={prod.color} />)}+ {!selfServe && (+ <Alert variant="info">+ <Info />+ <AlertTitle>Billing is managed by our team</AlertTitle>+ <AlertDescription>+ Your plan is on a custom agreement, so self-serve changes are disabled.+ Contact sales to adjust products, commitments, or your subscription.+ </AlertDescription>+ </Alert>+ )}+<div className={`grid gap-3.5 ${gridCols}`}>{plans.map((plan) => (<PlanCard@@ -532,8 +646,8 @@ export const ProductSheet = ({isCurrent={entitled && plan.tier === currentTier}canChangeCommitment={showChangeCommitment}hasCommitment={hasCommitment}+ selfServe={selfServe}onActivate={openActivate}- onStartTrial={setTrialConfirmTier}onChangeCommitment={() => setView("commitment")}onContact={() => onContact(prod)}/>@@ -552,11 +666,19 @@ export const ProductSheet = ({{entitled ? (<>{isTrialing ? (- <Button variant="danger" onClick={() => setShowCancelTrial(true)}>+ <Button+ variant="danger"+ isDisabled={!selfServe}+ onClick={() => setShowCancelTrial(true)}+ >Cancel trial</Button>) : (- <Button variant="danger" onClick={() => onRemove(prod.id)}>+ <Button+ variant="danger"+ isDisabled={!selfServe}+ onClick={() => onRemove(prod.id)}+ >Remove product</Button>)}@@ -595,7 +717,7 @@ export const ProductSheet = ({</AlertDialogMedia><AlertDialogTitle>Start your {prod.name} trial</AlertDialogTitle><AlertDialogDescription>- Your 30-day trial is free. After it ends, your subscription continues automatically+ Your 14-day trial is free. After it ends, your subscription continues automaticallyand you'll be billed monthly based on usage. Cancel before the trial ends toavoid charges.</AlertDialogDescription>diff --git a/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx b/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsxindex 211f7e6ed6..b78e7545d1 100644--- a/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx@@ -1,5 +1,5 @@import { CSSProperties, ReactNode } from "react";-import { ArrowBigUpDashIcon, DollarSign, Package, RefreshCw } from "lucide-react";+import { ArrowBigUpDashIcon, DollarSign, Package, RefreshCw, Sparkles } from "lucide-react";import { createNotification } from "@app/components/notifications";import {@@ -39,6 +39,7 @@ type ActiveProductCardProps = {prod: BillingV2CatalogProduct;entitlement?: BillingV2Entitlement;readOnly?: boolean;+ selfServe: boolean;onManage: (id: string) => void;onSetCommitment: (id: string) => void;};@@ -48,12 +49,13 @@ const ActiveProductCard = ({prod,entitlement,readOnly,+ selfServe,onManage,onSetCommitment}: ActiveProductCardProps) => {// "Commit annually and save" nudge: shown when the org holds this product monthly but hasn't set the- // available commitment. Clicking opens the set-commitment flow.- const commitNudge = readOnly ? null : commitSavingsNudge(entitlement);+ // available commitment. Clicking opens the set-commitment flow. Hidden for enterprise-managed orgs.+ const commitNudge = readOnly || !selfServe ? null : commitSavingsNudge(entitlement);// Every deprecation is presented as a retiring plan for now (see asPlanDeprecation).const deprecation = !entitlement?.planTier?.includes("enterprise")? asPlanDeprecation(entitlement?.deprecation)@@ -146,8 +148,7 @@ const ActiveProductCard = ({)}{!hasPrice && <span className="text-sm text-muted">Included</span>}</div>- {!readOnly && (- // A retiring plan nudges the customer toward the replacement; everything else opens Manage.+ {!readOnly && selfServe && (<Buttonvariant="outline"size="sm"@@ -174,12 +175,11 @@ const ActiveProductCard = ({</span><span>Commit annually and save{" "}- <span className="font-medium text-foreground">~{commitNudge.savingsPct}%</span> —{" "}- {commitNudge.qty.toLocaleString()} {commitNudge.label} would be{" "}+ <span className="font-medium text-foreground">~{commitNudge.savingsPct}%</span> —+ would be{" "}<span className="font-medium text-foreground">{fmtMoney(commitNudge.annualCommitted)} / yr- </span>{" "}- instead of {fmtMoney(commitNudge.monthlyAnnualized)}.+ </span></span></span><Button@@ -199,19 +199,23 @@ const ActiveProductCard = ({type AvailableProductTileProps = {prod: BillingV2CatalogProduct;readOnly?: boolean;+ // This product's one-per-product trial is already used up, so it can only be activated, not trialed.+ trialUsed?: boolean;onManage: (id: string) => void;onContact: (prod: BillingV2CatalogProduct) => void;};-// Compact tile for a product the org doesn't hold yet: tagline plus an activate / contact action.+// Compact tile for a product the org doesn't hold yet: tagline plus an activate / trial / contact action.const AvailableProductTile = ({prod,readOnly,+ trialUsed,onManage,onContact}: AvailableProductTileProps) => {const selfServe = prod.plans.some((plan) => plan.selfServe);const salesLed = prod.plans.some((plan) => plan.salesLed);+ const offersTrial = !trialUsed && prod.plans.some((plan) => plan.selfServe && plan.trialable);let action = null;if (!readOnly) {@@ -223,8 +227,8 @@ const AvailableProductTile = ({style={{ "--product-color": prod.color } as CSSProperties}onClick={() => onManage(prod.id)}>- <ArrowBigUpDashIcon />- Activate+ {offersTrial ? <Sparkles /> : <ArrowBigUpDashIcon />}+ {offersTrial ? "Start a free trial" : "Activate"}</Button>);} else if (salesLed) {@@ -336,6 +340,7 @@ export const ProductsCard = ({prod={prod}entitlement={overview.entitlements[prod.id]}readOnly={readOnly}+ selfServe={overview.selfServe}onManage={onManage}onSetCommitment={onSetCommitment}/>@@ -354,6 +359,7 @@ export const ProductsCard = ({key={prod.id}prod={prod}readOnly={readOnly}+ trialUsed={overview.trialedProductKeys.includes(prod.id)}onManage={onManage}onContact={onContact}/>