Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(billing): License Server v2 customer billing page

Tre Dubravaf883f96a7a38
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.ts
index 80c501d3e4..a4b5f100b9 100644
--- a/backend/src/@types/fastify.d.ts
+++ b/backend/src/@types/fastify.d.ts
@@ -33,6 +33,7 @@ import { TKmipServiceFactory } from "@app/ee/services/kmip/kmip-service";
import { TKmipServerServiceFactory } from "@app/ee/services/kmip-server/kmip-server-service";
import { TLdapConfigServiceFactory } from "@app/ee/services/ldap-config/ldap-config-service";
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
+import { TLicenseV2ServiceFactory } from "@app/ee/services/license-v2/license-v2-service";
import { TOidcConfigServiceFactory } from "@app/ee/services/oidc/oidc-config-service";
import { TPamAccountServiceFactory } from "@app/ee/services/pam-account/pam-account-service";
import { TPamAccountPolicyServiceFactory } from "@app/ee/services/pam-account-policy/pam-account-policy-service";
@@ -371,6 +372,7 @@ declare module "fastify" {
secretScanning: TSecretScanningServiceFactory;
license: TLicenseServiceFactory;
licenseClient: TLicenseClientFactory;
+ licenseV2: TLicenseV2ServiceFactory;
trustedIp: TTrustedIpServiceFactory;
secretBlindIndex: TSecretBlindIndexServiceFactory;
telemetry: TTelemetryServiceFactory;
diff --git a/backend/src/ee/routes/v1/index.ts b/backend/src/ee/routes/v1/index.ts
index a9e50dfb2a..79e9c7d8c1 100644
--- a/backend/src/ee/routes/v1/index.ts
+++ b/backend/src/ee/routes/v1/index.ts
@@ -32,6 +32,7 @@ import { registerKmipServerRouter } from "./kmip-server-router";
import { registerKmipSpecRouter } from "./kmip-spec-router";
import { registerLdapRouter } from "./ldap-router";
import { registerLicenseRouter } from "./license-router";
+import { registerLicenseV2Router } from "./license-v2-router";
import { registerOidcRouter } from "./oidc-router";
import { registerOrgRoleRouter } from "./org-role-router";
import { registerPamAccountPolicyRouter } from "./pam-account-policy-router";
@@ -81,6 +82,7 @@ export const registerV1EERoutes = async (server: FastifyZodProvider) => {
await server.register(registerOrgRoleRouter, { prefix: "/organization" });
await server.register(registerSubOrgRouter, { prefix: "/sub-organizations" });
await server.register(registerLicenseRouter, { prefix: "/organizations" });
+ await server.register(registerLicenseV2Router, { prefix: "/organizations" });
await server.register(registerEmailDomainRouter, { prefix: "/email-domains" });
// depreciated in favour of infisical workspace
diff --git a/backend/src/ee/routes/v1/license-v2-router.ts b/backend/src/ee/routes/v1/license-v2-router.ts
new file mode 100644
index 0000000000..b6d329a23b
--- /dev/null
+++ b/backend/src/ee/routes/v1/license-v2-router.ts
@@ -0,0 +1,219 @@
+import { FastifyRequest } from "fastify";
+import { z } from "zod";
+
+import { NotFoundError } from "@app/lib/errors";
+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AuthMode } from "@app/services/auth/auth-type";
+
+// The license server joins this onto its configured portal origin, so it must be a relative path.
+const ReturnPathSchema = z.string().trim().startsWith("/").optional();
+
+const BillingV2DimSchema = z.object({
+ key: z.string(),
+ label: z.string(),
+ noun: z.string(),
+ monthly: z.number(),
+ annual: z.number(),
+ included: z.number()
+});
+
+const BillingV2CompareRowSchema = z.object({
+ label: z.string(),
+ pro: z.union([z.string(), z.boolean()]),
+ ent: z.union([z.string(), z.boolean()])
+});
+
+const BillingV2CatalogProductSchema = z.object({
+ id: z.string(),
+ name: z.string(),
+ icon: z.string(),
+ color: z.string(),
+ model: z.enum(["seat", "usage", "limit", "flat"]),
+ addon: z.boolean().optional(),
+ desc: z.string(),
+ tagline: z.string().optional(),
+ fromPrice: z.string().optional(),
+ pro: z.object({
+ base: z.object({ monthly: z.number(), annual: z.number() }).optional(),
+ dims: BillingV2DimSchema.array().optional(),
+ proFeature: z.string(),
+ planKey: z.string().optional()
+ }),
+ enterprise: z.object({ sales: z.literal(true), feature: z.string() }).nullable(),
+ upgradeChanges: z.object({ add: z.string().array() }).optional(),
+ includes: z.string().array().optional(),
+ compare: BillingV2CompareRowSchema.array().optional()
+});
+
+const BillingV2InvoiceSchema = z.object({
+ id: z.string(),
+ number: z.string(),
+ date: z.string(),
+ amount: z.number(),
+ paid: z.boolean(),
+ pdfUrl: z.string()
+});
+
+const BillingV2EntitlementSchema = z.object({
+ entitled: z.boolean(),
+ limit: z.number().nullable().optional(),
+ used: z.number().optional()
+});
+
+const BillingV2OverviewSchema = z.object({
+ isCloud: z.boolean(),
+ mode: z.enum(["self-serve", "managed"]),
+ subState: z.enum(["active", "trialing", "past-due", "suspended", "no-subscription"]),
+ planName: z.string(),
+ nextBillingDate: z.string().nullable(),
+ recurringAmount: z.number().nullable(),
+ interval: z.enum(["month", "year"]).nullable(),
+ usage: z.object({
+ members: z.number(),
+ memberLimit: z.number().nullable(),
+ identities: z.number(),
+ identityLimit: z.number().nullable()
+ }),
+ payment: z.object({ brand: z.string(), last4: z.string(), expMonth: z.number(), expYear: z.number() }).nullable(),
+ billingDetails: z.object({ name: z.string(), email: z.string() }).nullable(),
+ invoices: BillingV2InvoiceSchema.array(),
+ entitlements: z.record(BillingV2EntitlementSchema)
+});
+
+export const registerLicenseV2Router = async (server: FastifyZodProvider) => {
+ // Every route is gated by LICENSE_SERVER_V2_ENABLED; the surface is invisible when the flag is off.
+ server.addHook("onRequest", async () => {
+ if (!server.services.licenseV2.isEnabled()) {
+ throw new NotFoundError({ message: "License Server v2 is not enabled" });
+ }
+ });
+
+ const buildActor = (permission: FastifyRequest["permission"]) => ({
+ type: permission.type,
+ id: permission.id,
+ authMethod: permission.authMethod,
+ orgId: permission.orgId,
+ rootOrgId: permission.rootOrgId,
+ parentOrgId: permission.parentOrgId
+ });
+
+ server.route({
+ method: "GET",
+ url: "/:organizationId/billing/v2/overview",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ params: z.object({ organizationId: z.string().trim() }),
+ response: {
+ 200: z.object({ overview: BillingV2OverviewSchema })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ return server.services.licenseV2.getOverview({
+ orgId: req.params.organizationId,
+ actor: buildActor(req.permission)
+ });
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: "/:organizationId/billing/v2/catalog",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ params: z.object({ organizationId: z.string().trim() }),
+ response: {
+ 200: z.object({ products: BillingV2CatalogProductSchema.array() })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ return server.services.licenseV2.getCatalog({
+ orgId: req.params.organizationId,
+ actor: buildActor(req.permission)
+ });
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/:organizationId/billing/v2/portal-session",
+ config: {
+ rateLimit: writeLimit
+ },
+ schema: {
+ params: z.object({ organizationId: z.string().trim() }),
+ body: z.object({ returnPath: ReturnPathSchema }),
+ response: {
+ 200: z.object({ url: z.string() })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ return server.services.licenseV2.portalSession({
+ orgId: req.params.organizationId,
+ actor: buildActor(req.permission),
+ returnPath: req.body.returnPath
+ });
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/:organizationId/billing/v2/checkout-session",
+ config: {
+ rateLimit: writeLimit
+ },
+ schema: {
+ params: z.object({ organizationId: z.string().trim() }),
+ body: z.object({
+ productId: z.string().trim(),
+ cadence: z.enum(["monthly", "annual"]).optional(),
+ email: z.string().trim().email().optional(),
+ returnPath: ReturnPathSchema
+ }),
+ response: {
+ 200: z.object({ url: z.string() })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ return server.services.licenseV2.checkoutSession({
+ orgId: req.params.organizationId,
+ actor: buildActor(req.permission),
+ productId: req.body.productId,
+ cadence: req.body.cadence,
+ email: req.body.email,
+ returnPath: req.body.returnPath
+ });
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/:organizationId/billing/v2/payment-method",
+ config: {
+ rateLimit: writeLimit
+ },
+ schema: {
+ params: z.object({ organizationId: z.string().trim() }),
+ body: z.object({ returnPath: ReturnPathSchema }),
+ response: {
+ 200: z.object({ url: z.string() })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ return server.services.licenseV2.addPaymentMethod({
+ orgId: req.params.organizationId,
+ actor: buildActor(req.permission),
+ returnPath: req.body.returnPath
+ });
+ }
+ });
+};
diff --git a/backend/src/ee/services/license-v2/license-v2-service.ts b/backend/src/ee/services/license-v2/license-v2-service.ts
new file mode 100644
index 0000000000..435739dbf1
--- /dev/null
+++ b/backend/src/ee/services/license-v2/license-v2-service.ts
@@ -0,0 +1,424 @@
+import { ForbiddenError } from "@casl/ability";
+
+import { OrganizationActionScope } from "@app/db/schemas";
+import { TEnvConfig } from "@app/lib/config/env";
+import { BadRequestError, NotFoundError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+import { TLicenseClientFactory } from "@app/services/license-client";
+import {
+ TCatalogProduct,
+ TCheckoutLineItem,
+ TSubscriptionResponse
+} from "@app/services/license-client/license-client-types";
+import { TOrgDALFactory } from "@app/services/org/org-dal";
+
+import { OrgPermissionBillingActions, OrgPermissionSubjects } from "../permission/org-permission";
+import { TPermissionServiceFactory } from "../permission/permission-service-types";
+import {
+ BillingV2CatalogProduct,
+ BillingV2CompareRow,
+ BillingV2Dim,
+ BillingV2Entitlement,
+ BillingV2Model,
+ BillingV2Overview,
+ BillingV2SubState,
+ TAddBillingV2PaymentMethodDTO,
+ TCreateBillingV2CheckoutSessionDTO,
+ TCreateBillingV2PortalSessionDTO,
+ TGetBillingV2CatalogDTO,
+ TGetBillingV2OverviewDTO
+} from "./license-v2-types";
+
+type TLicenseV2ServiceFactoryDep = {
+ envConfig: Pick<TEnvConfig, "LICENSE_SERVER_V2_ENABLED">;
+ orgDAL: Pick<TOrgDALFactory, "findById" | "countAllOrgMembers">;
+ permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;
+ licenseClient: Pick<
+ TLicenseClientFactory,
+ "getEntitlements" | "getCatalog" | "getSubscription" | "createCheckout" | "createPortal"
+ >;
+};
+
+export type TLicenseV2ServiceFactory = ReturnType<typeof licenseV2ServiceFactory>;
+
+// Presentation metadata the license server does not provide, keyed by the server's real product ids.
+const PRODUCT_PRESENTATION: Record<string, { icon: string; color: string }> = {
+ secrets_management: { icon: "IconKey", color: "#457d91" },
+ cert_management: { icon: "IconShieldCheck", color: "#4c6081" },
+ pam: { icon: "IconLock", color: "#694c81" },
+ secrets_scanning: { icon: "IconScan", color: "#a6702b" },
+ boost: { icon: "IconZap", color: "#a4873e" }
+};
+
+const DEFAULT_PRESENTATION = { icon: "IconBox", color: "#6b7280" };
+
+const CATALOG_MODELS: BillingV2Model[] = ["seat", "usage", "limit", "flat"];
+
+const toModel = (model: string): BillingV2Model => {
+ if (CATALOG_MODELS.includes(model as BillingV2Model)) {
+ return model as BillingV2Model;
+ }
+ return "usage";
+};
+
+const centsToDollars = (cents: number | null | undefined): number => {
+ if (!cents) {
+ return 0;
+ }
+ return cents / 100;
+};
+
+const formatDate = (unixSeconds: number | null | undefined): string | null => {
+ if (!unixSeconds) {
+ return null;
+ }
+ return new Date(unixSeconds * 1000).toLocaleDateString("en-US", {
+ year: "numeric",
+ month: "long",
+ day: "numeric"
+ });
+};
+
+const resolveSubState = (subscription: TSubscriptionResponse | null): BillingV2SubState => {
+ if (!subscription || !subscription.status) {
+ return "no-subscription";
+ }
+ const status = subscription.status.toLowerCase();
+ if (status === "trialing") {
+ return "trialing";
+ }
+ if (status === "past_due") {
+ return "past-due";
+ }
+ if (status === "unpaid" || status === "canceled" || status === "incomplete") {
+ return "suspended";
+ }
+ if (status === "none" || status === "") {
+ return "no-subscription";
+ }
+ return "active";
+};
+
+const resolveInterval = (cadence: string | null | undefined): "month" | "year" | null => {
+ if (cadence === "month" || cadence === "year") {
+ return cadence;
+ }
+ return null;
+};
+
+const normalizeCadence = (cadence: string | undefined): "monthly" | "annual" => {
+ if (cadence === "annual") {
+ return "annual";
+ }
+ return "monthly";
+};
+
+// The paid self-serve plan (e.g. "pro"); the free tier is self-serve too but carries no prices.
+const findPaidSelfServePlan = (product: TCatalogProduct) =>
+ product.plans.find((plan) => plan.selfServe === true && plan.tier !== "free" && plan.prices.length > 0);
+
+const toCatalogProduct = (product: TCatalogProduct): BillingV2CatalogProduct => {
+ const presentation = PRODUCT_PRESENTATION[product.id] ?? DEFAULT_PRESENTATION;
+
+ const paidSelfServePlan = findPaidSelfServePlan(product);
+ const salesLedPlan = product.plans.find((plan) => plan.salesLed === true);
+
+ // Fold the plan's per-dimension/per-cadence prices into the dim view the UI renders.
+ const priceByDim = new Map<string, { monthly: number; annual: number; included: number }>();
+ (paidSelfServePlan?.prices ?? []).forEach((price) => {
+ const entry = priceByDim.get(price.dimensionKey) ?? { monthly: 0, annual: 0, included: 0 };
+ if (price.cadence === "annual") {
+ entry.annual = centsToDollars(price.unitAmountCents);
+ } else {
+ entry.monthly = centsToDollars(price.unitAmountCents);
+ }
+ if (price.includedQuantity !== null && price.includedQuantity !== undefined) {
+ entry.included = price.includedQuantity;
+ }
+ priceByDim.set(price.dimensionKey, entry);
+ });
+
+ const dims: BillingV2Dim[] = [];
+ product.dimensions.forEach((dimension) => {
+ const priced = priceByDim.get(dimension.key);
+ if (!priced) {
+ return;
+ }
+ dims.push({
+ key: dimension.key,
+ label: dimension.label,
+ noun: dimension.noun,
+ monthly: priced.monthly,
+ annual: priced.annual,
+ included: priced.included
+ });
+ });
+
+ const pro: BillingV2CatalogProduct["pro"] = {
+ proFeature: paidSelfServePlan?.feature ?? "",
+ planKey: paidSelfServePlan?.tier,
+ dims
+ };
+ const baseMonthly = paidSelfServePlan?.basePriceMonthlyCents;
+ const baseAnnual = paidSelfServePlan?.basePriceAnnualCents;
+ if ((baseMonthly !== null && baseMonthly !== undefined) || (baseAnnual !== null && baseAnnual !== undefined)) {
+ pro.base = { monthly: centsToDollars(baseMonthly), annual: centsToDollars(baseAnnual) };
+ }
+
+ let enterprise: BillingV2CatalogProduct["enterprise"] = null;
+ if (salesLedPlan) {
+ enterprise = { sales: true, feature: salesLedPlan.feature ?? "" };
+ }
+
+ const cellValue = (cells: { tier: string; value: string | boolean }[], tier: string): string | boolean => {
+ const cell = cells.find((candidate) => candidate.tier === tier);
+ if (!cell) {
+ return false;
+ }
+ return cell.value;
+ };
+
+ const compare: BillingV2CompareRow[] = product.comparison.map((row) => ({
+ label: row.label,
+ pro: cellValue(row.cells, "pro"),
+ ent: cellValue(row.cells, "enterprise")
+ }));
+
+ return {
+ id: product.id,
+ name: product.name,
+ icon: presentation.icon,
+ color: presentation.color,
+ model: toModel(product.model),
+ addon: product.addon,
+ desc: product.description ?? "",
+ tagline: product.tagline,
+ pro,
+ enterprise,
+ includes: product.includes,
+ compare
+ };
+};
+
+// Translates a catalog product into the line items the checkout endpoint expects: its paid
+// self-serve plan plus the primary priced dimension for the chosen cadence at quantity 1.
+const buildCheckoutItems = (product: TCatalogProduct, cadence: "monthly" | "annual"): TCheckoutLineItem[] | null => {
+ const paidSelfServePlan = findPaidSelfServePlan(product);
+ if (!paidSelfServePlan) {
+ return null;
+ }
+
+ const price = paidSelfServePlan.prices.find(
+ (candidate) => candidate.cadence === cadence && candidate.unitAmountCents > 0
+ );
+ if (!price) {
+ return null;
+ }
+
+ return [
+ {
+ productId: product.id,
+ plan: paidSelfServePlan.tier,
+ cadence,
+ quantities: { [price.dimensionKey]: 1 }
+ }
+ ];
+};
+
+export const licenseV2ServiceFactory = ({
+ envConfig,
+ orgDAL,
+ permissionService,
+ licenseClient
+}: TLicenseV2ServiceFactoryDep) => {
+ const ensureBillingRead = async (orgId: string, actor: TGetBillingV2OverviewDTO["actor"]) => {
+ const { permission } = await permissionService.getOrgPermission({
+ actorId: actor.id,
+ actor: actor.type,
+ orgId,
+ actorOrgId: actor.orgId,
+ actorAuthMethod: actor.authMethod,
+ scope: OrganizationActionScope.ParentOrganization
+ });
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionBillingActions.Read, OrgPermissionSubjects.Billing);
+ };
+
+ const ensureManageBilling = async (orgId: string, actor: TGetBillingV2OverviewDTO["actor"]) => {
+ const { permission } = await permissionService.getOrgPermission({
+ actorId: actor.id,
+ actor: actor.type,
+ orgId,
+ actorOrgId: actor.orgId,
+ actorAuthMethod: actor.authMethod,
+ scope: OrganizationActionScope.ParentOrganization
+ });
+ ForbiddenError.from(permission).throwUnlessCan(
+ OrgPermissionBillingActions.ManageBilling,
+ OrgPermissionSubjects.Billing
+ );
+ };
+
+ // Fold the subscription items and the entitlement features sourced from a product into a single
+ // per-product entitlement map, keyed by the server's product ids.
+ const buildEntitlements = async (orgId: string, subscription: TSubscriptionResponse | null) => {
+ const entitlements: Record<string, BillingV2Entitlement> = {};
+
+ if (subscription) {
+ subscription.items.forEach((item) => {
+ const quantityValues = Object.values(item.quantities);
+ let used = 0;
+ if (quantityValues.length > 0) {
+ used = Math.max(...quantityValues);
+ }
+
+ const limitValues = Object.values(item.limits);
+ let limit: number | null = null;
+ if (limitValues.length > 0) {
+ limit = Math.max(...limitValues);
+ }
+
+ entitlements[item.productId] = { entitled: true, used, limit };
+ });
+ }
+
+ let features = null;
+ try {
+ const result = await licenseClient.getEntitlements(orgId);
+ features = result?.features ?? null;
+ } catch (error) {
+ logger.error(error, `billing-v2: failed to read entitlements [orgId=${orgId}]`);
+ }
+
+ if (features) {
+ Object.values(features).forEach((feature) => {
+ const productId = feature.from_product;
+ if (!productId) {
+ return;
+ }
+ if (!entitlements[productId]) {
+ entitlements[productId] = { entitled: true };
+ }
+ });
+ }
+
+ return entitlements;
+ };
+
+ const getOverview = async ({ orgId, actor }: TGetBillingV2OverviewDTO) => {
+ await ensureBillingRead(orgId, actor);
+
+ const organization = await orgDAL.findById(orgId);
+ if (!organization) {
+ throw new NotFoundError({ message: `Organization with ID '${orgId}' not found` });
+ }
+
+ // A reachable server with no subscription returns null; a thrown error means the billing service
+ // is unreachable, so surface it (the UI shows an error state) rather than masquerading as "Free".
+ let subscription: TSubscriptionResponse | null = null;
+ try {
+ subscription = await licenseClient.getSubscription(orgId);
+ } catch (error) {
+ logger.error(error, `billing-v2: failed to read subscription [orgId=${orgId}]`);
+ throw error;
+ }
+
+ const subState = resolveSubState(subscription);
+
+ let interval: "month" | "year" | null = null;
+ let nextBillingDate: string | null = null;
+ let recurringAmount: number | null = null;
+ if (subscription) {
+ interval = resolveInterval(subscription.cadence);
+ nextBillingDate = formatDate(subscription.currentPeriodEnd);
+ if (subscription.recurringTotal !== null) {
+ recurringAmount = centsToDollars(subscription.recurringTotal);
+ }
+ }
+
+ const members = await orgDAL.countAllOrgMembers(orgId);
+
+ const overview: BillingV2Overview = {
+ isCloud: true,
+ mode: "self-serve",
+ subState,
+ planName: subState === "no-subscription" ? "Free" : "Pro",
+ nextBillingDate,
+ recurringAmount,
+ interval,
+ usage: {
+ members,
+ memberLimit: null,
+ identities: 0,
+ identityLimit: null
+ },
+ payment: null,
+ billingDetails: null,
+ invoices: [],
+ entitlements: await buildEntitlements(orgId, subscription)
+ };
+
+ return { overview };
+ };
+
+ const getCatalog = async ({ orgId, actor }: TGetBillingV2CatalogDTO) => {
+ await ensureBillingRead(orgId, actor);
+
+ const catalog = await licenseClient.getCatalog();
+ if (!catalog) {
+ return { products: [] };
+ }
+
+ const products = catalog.products.map(toCatalogProduct);
+ return { products };
+ };
+
+ // Stripe billing portal: manages the existing subscription, payment methods, and billing details.
+ const openPortal = async (orgId: string, returnPath?: string) => {
+ const session = await licenseClient.createPortal(orgId, { returnPath });
+ return { url: session.url };
+ };
+
+ const portalSession = async ({ orgId, actor, returnPath }: TCreateBillingV2PortalSessionDTO) => {
+ await ensureManageBilling(orgId, actor);
+ return openPortal(orgId, returnPath);
+ };
+
+ const checkoutSession = async ({
+ orgId,
+ actor,
+ productId,
+ cadence,
+ email,
+ returnPath
+ }: TCreateBillingV2CheckoutSessionDTO) => {
+ await ensureManageBilling(orgId, actor);
+
+ const catalog = await licenseClient.getCatalog();
+ const product = catalog?.products.find((candidate) => candidate.id === productId);
+ if (!product) {
+ throw new NotFoundError({ message: `Product with ID '${productId}' not found` });
+ }
+
+ const items = buildCheckoutItems(product, normalizeCadence(cadence));
+ if (!items) {
+ throw new BadRequestError({ message: "This product is not available for self-serve checkout" });
+ }
+
+ const session = await licenseClient.createCheckout(orgId, { items, email, returnPath });
+ return { url: session.url };
+ };
+
+ const addPaymentMethod = async ({ orgId, actor, returnPath }: TAddBillingV2PaymentMethodDTO) => {
+ await ensureManageBilling(orgId, actor);
+ return openPortal(orgId, returnPath);
+ };
+
+ return {
+ isEnabled: () => envConfig.LICENSE_SERVER_V2_ENABLED,
+ getOverview,
+ getCatalog,
+ portalSession,
+ checkoutSession,
+ addPaymentMethod
+ };
+};
diff --git a/backend/src/ee/services/license-v2/license-v2-types.ts b/backend/src/ee/services/license-v2/license-v2-types.ts
new file mode 100644
index 0000000000..9adf688fdd
--- /dev/null
+++ b/backend/src/ee/services/license-v2/license-v2-types.ts
@@ -0,0 +1,119 @@
+import { OrgServiceActor } from "@app/lib/types";
+
+export type BillingV2Model = "seat" | "usage" | "limit" | "flat";
+
+export type BillingV2SubState = "active" | "trialing" | "past-due" | "suspended" | "no-subscription";
+
+export type BillingV2Mode = "self-serve" | "managed";
+
+export type BillingV2Dim = {
+ key: string;
+ label: string;
+ noun: string;
+ monthly: number;
+ annual: number;
+ included: number;
+};
+
+export type BillingV2CompareRow = {
+ label: string;
+ pro: string | boolean;
+ ent: string | boolean;
+};
+
+export type BillingV2CatalogProduct = {
+ id: string;
+ name: string;
+ icon: string;
+ color: string;
+ model: BillingV2Model;
+ addon?: boolean;
+ desc: string;
+ tagline?: string;
+ fromPrice?: string;
+ pro: {
+ base?: { monthly: number; annual: number };
+ dims?: BillingV2Dim[];
+ proFeature: string;
+ planKey?: string;
+ };
+ enterprise: { sales: true; feature: string } | null;
+ upgradeChanges?: { add: string[] };
+ includes?: string[];
+ compare?: BillingV2CompareRow[];
+};
+
+export type BillingV2PaymentMethod = {
+ brand: string;
+ last4: string;
+ expMonth: number;
+ expYear: number;
+} | null;
+
+export type BillingV2Invoice = {
+ id: string;
+ number: string;
+ date: string;
+ amount: number;
+ paid: boolean;
+ pdfUrl: string;
+};
+
+export type BillingV2Entitlement = {
+ entitled: boolean;
+ limit?: number | null;
+ used?: number;
+};
+
+export type BillingV2Usage = {
+ members: number;
+ memberLimit: number | null;
+ identities: number;
+ identityLimit: number | null;
+};
+
+export type BillingV2Overview = {
+ isCloud: boolean;
+ mode: BillingV2Mode;
+ subState: BillingV2SubState;
+ planName: string;
+ nextBillingDate: string | null;
+ recurringAmount: number | null;
+ interval: "month" | "year" | null;
+ usage: BillingV2Usage;
+ payment: BillingV2PaymentMethod;
+ billingDetails: { name: string; email: string } | null;
+ invoices: BillingV2Invoice[];
+ entitlements: Record<string, BillingV2Entitlement>;
+};
+
+export type TGetBillingV2OverviewDTO = {
+ orgId: string;
+ actor: OrgServiceActor;
+};
+
+export type TGetBillingV2CatalogDTO = {
+ orgId: string;
+ actor: OrgServiceActor;
+};
+
+export type TCreateBillingV2PortalSessionDTO = {
+ orgId: string;
+ actor: OrgServiceActor;
+ returnPath?: string;
+};
+
+export type TCreateBillingV2CheckoutSessionDTO = {
+ orgId: string;
+ actor: OrgServiceActor;
+ productId: string;
+ cadence?: "monthly" | "annual";
+ email?: string;
+ returnPath?: string;
+};
+
+export type TAddBillingV2PaymentMethodDTO = {
+ orgId: string;
+ actor: OrgServiceActor;
+ returnPath?: string;
+};
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index f66ad05043..a23c2e3845 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -321,6 +321,8 @@ const envSchema = z
LICENSE_SERVER_V2_ENABLED: zodStrBool.default("false"),
LICENSE_SERVER_V2_URL: zpStr(z.string().optional()),
LICENSE_SERVER_V2_SERVICE_KEY: zpStr(z.string().optional()),
+ LICENSE_SERVER_V2_ISSUER: zpStr(z.string().optional()),
+ LICENSE_SERVER_V2_AUDIENCE: zpStr(z.string().optional()),
// GENERIC
STANDALONE_MODE: z
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index f932ba0f20..1ca9f53e5f 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -98,6 +98,7 @@ import { ldapConfigServiceFactory } from "@app/ee/services/ldap-config/ldap-conf
import { ldapGroupMapDALFactory } from "@app/ee/services/ldap-config/ldap-group-map-dal";
import { licenseDALFactory } from "@app/ee/services/license/license-dal";
import { licenseServiceFactory } from "@app/ee/services/license/license-service";
+import { licenseV2ServiceFactory } from "@app/ee/services/license-v2/license-v2-service";
import { oidcConfigDALFactory } from "@app/ee/services/oidc/oidc-config-dal";
import { oidcConfigServiceFactory } from "@app/ee/services/oidc/oidc-config-service";
import { pamAccountDALFactory } from "@app/ee/services/pam-account/pam-account-dal";
@@ -820,6 +821,15 @@ export const registerRoutes = async (
source: usageSource
});
+ // Flag-gated v2 billing surface. Drives the catalog, subscription, and entitlement reads off the
+ // real license server via licenseClient; no new tables.
+ const licenseV2Service = licenseV2ServiceFactory({
+ envConfig,
+ orgDAL,
+ permissionService,
+ licenseClient
+ });
+
// Project events SSE service (for clients to subscribe to secret mutation events)
const projectEventsSSEService = projectEventsSSEServiceFactory({
projectEventsService,
@@ -3786,6 +3796,7 @@ export const registerRoutes = async (
secretScanning: secretScanningService,
license: licenseService,
licenseClient,
+ licenseV2: licenseV2Service,
trustedIp: trustedIpService,
scim: scimService,
secretBlindIndex: secretBlindIndexService,
diff --git a/backend/src/server/routes/v1/admin-router.ts b/backend/src/server/routes/v1/admin-router.ts
index ec0b2bc505..f58eea76cd 100644
--- a/backend/src/server/routes/v1/admin-router.ts
+++ b/backend/src/server/routes/v1/admin-router.ts
@@ -51,6 +51,7 @@ const SanitizedSuperAdminSchema = z.object({
isMigrationModeOn: z.boolean().optional(),
isSecretScanningDisabled: z.boolean().optional(),
isPublicSecretSharingDisabled: z.boolean().optional(),
+ licenseServerV2Enabled: z.boolean().optional(),
kubernetesAutoFetchServiceAccountToken: z.boolean().optional(),
paramsFolderSecretDetectionEnabled: z.boolean().optional(),
isOfflineUsageReportsEnabled: z.boolean().optional(),
@@ -99,7 +100,8 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => {
enabledLoginMethods: config.enabledLoginMethods,
authConsentContent: config.authConsentContent,
pageFrameContent: config.pageFrameContent,
- isPublicSecretSharingDisabled: serverEnvs.DISABLE_PUBLIC_SECRET_SHARING
+ isPublicSecretSharingDisabled: serverEnvs.DISABLE_PUBLIC_SECRET_SHARING,
+ licenseServerV2Enabled: serverEnvs.LICENSE_SERVER_V2_ENABLED
}
};
}
@@ -111,6 +113,7 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => {
isMigrationModeOn: serverEnvs.MAINTENANCE_MODE,
isSecretScanningDisabled: serverEnvs.DISABLE_SECRET_SCANNING,
isPublicSecretSharingDisabled: serverEnvs.DISABLE_PUBLIC_SECRET_SHARING,
+ licenseServerV2Enabled: serverEnvs.LICENSE_SERVER_V2_ENABLED,
kubernetesAutoFetchServiceAccountToken: serverEnvs.KUBERNETES_AUTO_FETCH_SERVICE_ACCOUNT_TOKEN,
paramsFolderSecretDetectionEnabled: serverEnvs.PARAMS_FOLDER_SECRET_DETECTION_ENABLED,
isOfflineUsageReportsEnabled: hasOfflineLicense
diff --git a/backend/src/services/license-client/license-client-backends.ts b/backend/src/services/license-client/license-client-backends.ts
index 8ec37652f5..dc3535f802 100644
--- a/backend/src/services/license-client/license-client-backends.ts
+++ b/backend/src/services/license-client/license-client-backends.ts
@@ -1,14 +1,49 @@
-import { entitlementsResponseSchema, TEntitlementsResponse, TLicenseClientBackend } from "./license-client-types";
+import jwt from "jsonwebtoken";
+
+import {
+ catalogResponseSchema,
+ entitlementsResponseSchema,
+ sessionResponseSchema,
+ subscriptionResponseSchema,
+ TCatalogResponse,
+ TCreateCheckoutPayload,
+ TCreatePortalPayload,
+ TEntitlementsResponse,
+ TLicenseClientBackend,
+ TSessionResponse,
+ TSubscriptionResponse
+} from "./license-client-types";
const ENTITLEMENTS_PATH = "/v1/entitlements";
+const PRODUCTS_PATH = "/v1/products";
+const SUBSCRIPTION_PATH = "/v1/subscription";
+const CHECKOUT_SESSION_PATH = "/v1/billing/checkout-session";
+const PORTAL_SESSION_PATH = "/v1/billing/portal-session";
+
+export type TLicenseServerAuth = {
+ hmacSecret: string;
+ issuer: string;
+ audience: string;
+};
+
+// The license server validates a short-lived HS256 service JWT (iss/aud/exp/sub), not the raw secret.
+// Mint a fresh token per request; signing is cheap and entitlement results are cached upstream.
+const mintServiceToken = (auth: TLicenseServerAuth): string =>
+ jwt.sign({}, auth.hmacSecret, {
+ algorithm: "HS256",
+ issuer: auth.issuer,
+ audience: auth.audience,
+ subject: "infisical-cloud",
+ expiresIn: "2m"
+ });
-export const licenseServerBackend = (serverUrl: string, serviceKey: string): TLicenseClientBackend => ({
+export const licenseServerBackend = (serverUrl: string, auth: TLicenseServerAuth): TLicenseClientBackend => ({
fetchEntitlements: async (orgId: string): Promise<TEntitlementsResponse> => {
const url = new URL(ENTITLEMENTS_PATH, serverUrl);
url.searchParams.set("org_id", orgId);
const res = await fetch(url, {
method: "GET",
- headers: { Authorization: `Bearer ${serviceKey}` },
+ headers: { Authorization: `Bearer ${mintServiceToken(auth)}` },
redirect: "manual"
});
if (!res.ok) {
@@ -16,5 +51,77 @@ export const licenseServerBackend = (serverUrl: string, serviceKey: string): TLi
}
const body: unknown = await res.json();
return entitlementsResponseSchema.parse(body);
+ },
+
+ fetchCatalog: async (): Promise<TCatalogResponse> => {
+ const url = new URL(PRODUCTS_PATH, serverUrl);
+ const res = await fetch(url, {
+ method: "GET",
+ headers: { Authorization: `Bearer ${mintServiceToken(auth)}` },
+ redirect: "manual"
+ });
+ if (!res.ok) {
+ throw new Error(`license server responded with ${res.status}`);
+ }
+ const body: unknown = await res.json();
+ return catalogResponseSchema.parse(body);
+ },
+
+ // A brand-new org has no subscription; the server answers with a 404/500 or an empty status.
+ // Any non-200 or empty payload is treated as "no subscription" so a new customer renders the
+ // no-subscription state instead of an error.
+ fetchSubscription: async (orgId: string): Promise<TSubscriptionResponse | null> => {
+ const url = new URL(SUBSCRIPTION_PATH, serverUrl);
+ url.searchParams.set("org_id", orgId);
+ const res = await fetch(url, {
+ method: "GET",
+ headers: { Authorization: `Bearer ${mintServiceToken(auth)}` },
+ redirect: "manual"
+ });
+ if (!res.ok) {
+ return null;
+ }
+
+ const body: unknown = await res.json();
+ const parsed = subscriptionResponseSchema.safeParse(body);
+ if (!parsed.success) {
+ return null;
+ }
+ if (!parsed.data.status) {
+ return null;
+ }
+ return parsed.data;
+ },
+
+ createCheckoutSession: async (orgId: string, payload: TCreateCheckoutPayload): Promise<TSessionResponse> => {
+ const url = new URL(CHECKOUT_SESSION_PATH, serverUrl);
+ url.searchParams.set("org_id", orgId);
+ const res = await fetch(url, {
+ method: "POST",
+ headers: { Authorization: `Bearer ${mintServiceToken(auth)}`, "Content-Type": "application/json" },
+ body: JSON.stringify(payload),
+ redirect: "manual"
+ });
+ if (!res.ok) {
+ throw new Error(`license server responded with ${res.status}`);
+ }
+ const body: unknown = await res.json();
+ return sessionResponseSchema.parse(body);
+ },
+
+ createPortalSession: async (orgId: string, payload: TCreatePortalPayload): Promise<TSessionResponse> => {
+ const url = new URL(PORTAL_SESSION_PATH, serverUrl);
+ url.searchParams.set("org_id", orgId);
+ const res = await fetch(url, {
+ method: "POST",
+ headers: { Authorization: `Bearer ${mintServiceToken(auth)}`, "Content-Type": "application/json" },
+ body: JSON.stringify(payload),
+ redirect: "manual"
+ });
+ if (!res.ok) {
+ throw new Error(`license server responded with ${res.status}`);
+ }
+ const body: unknown = await res.json();
+ return sessionResponseSchema.parse(body);
}
});
diff --git a/backend/src/services/license-client/license-client-cache.ts b/backend/src/services/license-client/license-client-cache.ts
index ef2fdb8a94..2e9870a4c0 100644
--- a/backend/src/services/license-client/license-client-cache.ts
+++ b/backend/src/services/license-client/license-client-cache.ts
@@ -6,7 +6,7 @@ import { TEntitlementsResponse, TLicenseClientBackend } from "./license-client-t
type TEntitlementResolverDep = {
keyStore: Pick<TKeyStoreFactory, "getItem" | "setItemWithExpiry">;
- backend: TLicenseClientBackend;
+ backend: Pick<TLicenseClientBackend, "fetchEntitlements">;
};
export type TEntitlementResolver = ReturnType<typeof entitlementResolverFactory>;
diff --git a/backend/src/services/license-client/license-client-types.ts b/backend/src/services/license-client/license-client-types.ts
index 75330113f7..1410ad9780 100644
--- a/backend/src/services/license-client/license-client-types.ts
+++ b/backend/src/services/license-client/license-client-types.ts
@@ -15,9 +15,127 @@ export const entitlementsResponseSchema = z
})
.passthrough();
+const catalogDimensionSchema = z
+ .object({
+ key: z.string(),
+ label: z.string(),
+ noun: z.string()
+ })
+ .passthrough();
+
+// Pricing lives on the plan: one row per dimension per cadence ("monthly"/"annual").
+const catalogPlanPriceSchema = z
+ .object({
+ dimensionKey: z.string(),
+ cadence: z.string(),
+ unitAmountCents: z.number(),
+ includedQuantity: z.number().nullish()
+ })
+ .passthrough();
+
+const catalogPlanSchema = z
+ .object({
+ tier: z.string(),
+ name: z.string(),
+ selfServe: z.boolean(),
+ salesLed: z.boolean(),
+ feature: z.string().optional(),
+ basePriceMonthlyCents: z.number().nullish(),
+ basePriceAnnualCents: z.number().nullish(),
+ prices: z.array(catalogPlanPriceSchema).default([])
+ })
+ .passthrough();
+
+const catalogComparisonCellSchema = z
+ .object({
+ tier: z.string(),
+ value: z.union([z.string(), z.boolean()])
+ })
+ .passthrough();
+
+const catalogComparisonSchema = z
+ .object({
+ label: z.string(),
+ cells: z.array(catalogComparisonCellSchema).default([])
+ })
+ .passthrough();
+
+const catalogProductSchema = z
+ .object({
+ id: z.string(),
+ name: z.string(),
+ description: z.string().optional(),
+ tagline: z.string().optional(),
+ model: z.string(),
+ addon: z.boolean(),
+ dimensions: z.array(catalogDimensionSchema),
+ plans: z.array(catalogPlanSchema),
+ comparison: z.array(catalogComparisonSchema),
+ includes: z.array(z.string())
+ })
+ .passthrough();
+
+export const catalogResponseSchema = z
+ .object({
+ products: z.array(catalogProductSchema)
+ })
+ .passthrough();
+
+const subscriptionItemSchema = z
+ .object({
+ productId: z.string(),
+ plan: z.string(),
+ quantities: z.record(z.string(), z.number()),
+ limits: z.record(z.string(), z.number()),
+ amount: z.number().optional()
+ })
+ .passthrough();
+
+export const subscriptionResponseSchema = z
+ .object({
+ status: z.string(),
+ cadence: z.string(),
+ currentPeriodEnd: z.number().nullable(),
+ recurringTotal: z.number().nullable(),
+ items: z.array(subscriptionItemSchema)
+ })
+ .passthrough();
+
+export const sessionResponseSchema = z
+ .object({
+ url: z.string()
+ })
+ .passthrough();
+
export type TEntitlementFeature = z.infer<typeof entitlementFeatureSchema>;
export type TEntitlementsResponse = z.infer<typeof entitlementsResponseSchema>;
+export type TCatalogProduct = z.infer<typeof catalogProductSchema>;
+export type TCatalogResponse = z.infer<typeof catalogResponseSchema>;
+export type TSubscriptionItem = z.infer<typeof subscriptionItemSchema>;
+export type TSubscriptionResponse = z.infer<typeof subscriptionResponseSchema>;
+export type TSessionResponse = z.infer<typeof sessionResponseSchema>;
+
+export type TCheckoutLineItem = {
+ productId: string;
+ plan: string;
+ cadence: string;
+ quantities: Record<string, number>;
+};
+
+export type TCreateCheckoutPayload = {
+ items: TCheckoutLineItem[];
+ email?: string;
+ returnPath?: string;
+};
+
+export type TCreatePortalPayload = {
+ returnPath?: string;
+};
export type TLicenseClientBackend = {
fetchEntitlements: (orgId: string) => Promise<TEntitlementsResponse>;
+ fetchCatalog: () => Promise<TCatalogResponse>;
+ fetchSubscription: (orgId: string) => Promise<TSubscriptionResponse | null>;
+ createCheckoutSession: (orgId: string, payload: TCreateCheckoutPayload) => Promise<TSessionResponse>;
+ createPortalSession: (orgId: string, payload: TCreatePortalPayload) => Promise<TSessionResponse>;
};
diff --git a/backend/src/services/license-client/license-client.ts b/backend/src/services/license-client/license-client.ts
index 81844ab1f3..f7d1fa4c98 100644
--- a/backend/src/services/license-client/license-client.ts
+++ b/backend/src/services/license-client/license-client.ts
@@ -5,10 +5,17 @@ import { logger } from "@app/lib/logger";
import { featureReaderFactory } from "./feature-reader";
import { licenseServerBackend } from "./license-client-backends";
import { entitlementResolverFactory } from "./license-client-cache";
-import { TLicenseClientBackend } from "./license-client-types";
+import { TCreateCheckoutPayload, TCreatePortalPayload, TLicenseClientBackend } from "./license-client-types";
type TLicenseClientFactoryDep = {
- envConfig: Pick<TEnvConfig, "LICENSE_SERVER_V2_ENABLED" | "LICENSE_SERVER_V2_URL" | "LICENSE_SERVER_V2_SERVICE_KEY">;
+ envConfig: Pick<
+ TEnvConfig,
+ | "LICENSE_SERVER_V2_ENABLED"
+ | "LICENSE_SERVER_V2_URL"
+ | "LICENSE_SERVER_V2_SERVICE_KEY"
+ | "LICENSE_SERVER_V2_ISSUER"
+ | "LICENSE_SERVER_V2_AUDIENCE"
+ >;
keyStore: Pick<TKeyStoreFactory, "getItem" | "setItemWithExpiry">;
};
@@ -22,14 +29,17 @@ const buildBackend = (envConfig: TLicenseClientFactoryDep["envConfig"]): TLicens
}
const serverUrl = envConfig.LICENSE_SERVER_V2_URL;
- if (!serverUrl || !envConfig.LICENSE_SERVER_V2_SERVICE_KEY) {
+ const hmacSecret = envConfig.LICENSE_SERVER_V2_SERVICE_KEY;
+ const issuer = envConfig.LICENSE_SERVER_V2_ISSUER;
+ const audience = envConfig.LICENSE_SERVER_V2_AUDIENCE;
+ if (!serverUrl || !hmacSecret || !issuer || !audience) {
logger.warn(
- "license-client: enabled but LICENSE_SERVER_V2_URL / LICENSE_SERVER_V2_SERVICE_KEY is missing; serving feature fallbacks"
+ "license-client: enabled but LICENSE_SERVER_V2_URL / _SERVICE_KEY / _ISSUER / _AUDIENCE is missing; serving feature fallbacks"
);
return null;
}
- return licenseServerBackend(serverUrl, envConfig.LICENSE_SERVER_V2_SERVICE_KEY);
+ return licenseServerBackend(serverUrl, { hmacSecret, issuer, audience });
};
export const licenseClientFactory = ({ envConfig, keyStore }: TLicenseClientFactoryDep) => {
@@ -43,5 +53,40 @@ export const licenseClientFactory = ({ envConfig, keyStore }: TLicenseClientFact
return resolver.getEntitlements(orgId);
};
- return featureReaderFactory({ getEntitlements });
+ const getCatalog = async () => {
+ if (!backend) {
+ return null;
+ }
+ return backend.fetchCatalog();
+ };
+
+ const getSubscription = async (orgId: string) => {
+ if (!backend) {
+ return null;
+ }
+ return backend.fetchSubscription(orgId);
+ };
+
+ const createCheckout = async (orgId: string, payload: TCreateCheckoutPayload) => {
+ if (!backend) {
+ throw new Error("license client backend is not configured");
+ }
+ return backend.createCheckoutSession(orgId, payload);
+ };
+
+ const createPortal = async (orgId: string, payload: TCreatePortalPayload) => {
+ if (!backend) {
+ throw new Error("license client backend is not configured");
+ }
+ return backend.createPortalSession(orgId, payload);
+ };
+
+ return {
+ ...featureReaderFactory({ getEntitlements }),
+ getEntitlements,
+ getCatalog,
+ getSubscription,
+ createCheckout,
+ createPortal
+ };
};
diff --git a/frontend/src/hooks/api/admin/types.ts b/frontend/src/hooks/api/admin/types.ts
index 3f9decbaeb..b976b9eb74 100644
--- a/frontend/src/hooks/api/admin/types.ts
+++ b/frontend/src/hooks/api/admin/types.ts
@@ -65,6 +65,7 @@ export type TServerConfig = {
invalidatingCache: boolean;
envOverrides?: Record<string, string>;
isPublicSecretSharingDisabled?: boolean;
+ licenseServerV2Enabled?: boolean;
// Super admin-only fields (omitted for non-super-admin callers)
instanceId?: string;
trustSamlEmails?: boolean;
diff --git a/frontend/src/hooks/api/billingV2/index.tsx b/frontend/src/hooks/api/billingV2/index.tsx
new file mode 100644
index 0000000000..4bf9e95164
--- /dev/null
+++ b/frontend/src/hooks/api/billingV2/index.tsx
@@ -0,0 +1,18 @@
+export {
+ useAddBillingV2PaymentMethod,
+ useCreateBillingV2CheckoutSession,
+ useCreateBillingV2PortalSession
+} from "./mutations";
+export { billingV2Keys, useGetBillingV2Catalog, useGetBillingV2Overview } from "./queries";
+export type {
+ BillingV2Cadence,
+ BillingV2CatalogProduct,
+ BillingV2CompareRow,
+ BillingV2Dim,
+ BillingV2Entitlement,
+ BillingV2Invoice,
+ BillingV2Model,
+ BillingV2Overview,
+ BillingV2PaymentMethod,
+ BillingV2SubState
+} from "./types";
diff --git a/frontend/src/hooks/api/billingV2/mutations.tsx b/frontend/src/hooks/api/billingV2/mutations.tsx
new file mode 100644
index 0000000000..4e47389a72
--- /dev/null
+++ b/frontend/src/hooks/api/billingV2/mutations.tsx
@@ -0,0 +1,60 @@
+import { useMutation } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import {
+ TAddBillingV2PaymentMethodDTO,
+ TCreateBillingV2CheckoutSessionDTO,
+ TCreateBillingV2PortalSessionDTO
+} from "./types";
+
+export const useCreateBillingV2PortalSession = () => {
+ return useMutation({
+ mutationFn: async ({ orgId, returnPath }: TCreateBillingV2PortalSessionDTO) => {
+ const {
+ data: { url }
+ } = await apiRequest.post<{ url: string }>(
+ `/api/v1/organizations/${orgId}/billing/v2/portal-session`,
+ { returnPath }
+ );
+
+ return url;
+ }
+ });
+};
+
+export const useCreateBillingV2CheckoutSession = () => {
+ return useMutation({
+ mutationFn: async ({
+ orgId,
+ productId,
+ cadence,
+ email,
+ returnPath
+ }: TCreateBillingV2CheckoutSessionDTO) => {
+ const {
+ data: { url }
+ } = await apiRequest.post<{ url: string }>(
+ `/api/v1/organizations/${orgId}/billing/v2/checkout-session`,
+ { productId, cadence, email, returnPath }
+ );
+
+ return url;
+ }
+ });
+};
+
+export const useAddBillingV2PaymentMethod = () => {
+ return useMutation({
+ mutationFn: async ({ orgId, returnPath }: TAddBillingV2PaymentMethodDTO) => {
+ const {
+ data: { url }
+ } = await apiRequest.post<{ url: string }>(
+ `/api/v1/organizations/${orgId}/billing/v2/payment-method`,
+ { returnPath }
+ );
+
+ return url;
+ }
+ });
+};
diff --git a/frontend/src/hooks/api/billingV2/queries.tsx b/frontend/src/hooks/api/billingV2/queries.tsx
new file mode 100644
index 0000000000..9f54cfe5eb
--- /dev/null
+++ b/frontend/src/hooks/api/billingV2/queries.tsx
@@ -0,0 +1,42 @@
+import { useQuery } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import { BillingV2CatalogProduct, BillingV2Overview } from "./types";
+
+export const billingV2Keys = {
+ overview: (orgId: string) => [{ orgId }, "billing-v2-overview"] as const,
+ catalog: (orgId: string) => [{ orgId }, "billing-v2-catalog"] as const
+};
+
+export const useGetBillingV2Overview = (orgId: string) => {
+ return useQuery({
+ queryKey: billingV2Keys.overview(orgId),
+ queryFn: async () => {
+ const {
+ data: { overview }
+ } = await apiRequest.get<{ overview: BillingV2Overview }>(
+ `/api/v1/organizations/${orgId}/billing/v2/overview`
+ );
+
+ return overview;
+ },
+ enabled: Boolean(orgId)
+ });
+};
+
+export const useGetBillingV2Catalog = (orgId: string) => {
+ return useQuery({
+ queryKey: billingV2Keys.catalog(orgId),
+ queryFn: async () => {
+ const {
+ data: { products }
+ } = await apiRequest.get<{ products: BillingV2CatalogProduct[] }>(
+ `/api/v1/organizations/${orgId}/billing/v2/catalog`
+ );
+
+ return products;
+ },
+ enabled: Boolean(orgId)
+ });
+};
diff --git a/frontend/src/hooks/api/billingV2/types.ts b/frontend/src/hooks/api/billingV2/types.ts
new file mode 100644
index 0000000000..dd51d1c1fa
--- /dev/null
+++ b/frontend/src/hooks/api/billingV2/types.ts
@@ -0,0 +1,106 @@
+export type BillingV2Model = "seat" | "usage" | "limit" | "flat";
+
+export type BillingV2Cadence = "monthly" | "annual";
+
+export type BillingV2Dim = {
+ key: string;
+ label: string;
+ noun: string;
+ monthly: number;
+ annual: number;
+ included: number;
+};
+
+export type BillingV2CompareRow = {
+ label: string;
+ pro: string | boolean;
+ ent: string | boolean;
+};
+
+export type BillingV2CatalogProduct = {
+ id: string;
+ name: string;
+ icon: string;
+ color: string;
+ model: BillingV2Model;
+ addon?: boolean;
+ desc: string;
+ tagline?: string;
+ pro: {
+ base?: { monthly: number; annual: number };
+ dims?: BillingV2Dim[];
+ proFeature: string;
+ planKey?: string;
+ };
+ enterprise: { sales: true; feature: string } | null;
+ upgradeChanges?: { add: string[] };
+ includes?: string[];
+ compare?: BillingV2CompareRow[];
+};
+
+export type BillingV2SubState =
+ | "active"
+ | "trialing"
+ | "past-due"
+ | "suspended"
+ | "no-subscription";
+
+export type BillingV2PaymentMethod = {
+ brand: string;
+ last4: string;
+ expMonth: number;
+ expYear: number;
+} | null;
+
+export type BillingV2Invoice = {
+ id: string;
+ number: string;
+ date: string;
+ amount: number;
+ paid: boolean;
+ pdfUrl: string | null;
+};
+
+export type BillingV2Entitlement = {
+ entitled: boolean;
+ limit?: number | null;
+ used?: number;
+};
+
+export type BillingV2Overview = {
+ isCloud: boolean;
+ mode: "self-serve" | "managed";
+ subState: BillingV2SubState;
+ planName: string;
+ nextBillingDate: string | null;
+ recurringAmount: number | null;
+ interval: "month" | "year" | null;
+ usage: {
+ members: number;
+ memberLimit: number | null;
+ identities: number;
+ identityLimit: number | null;
+ };
+ payment: BillingV2PaymentMethod;
+ billingDetails: { name: string; email: string } | null;
+ invoices: BillingV2Invoice[];
+ entitlements: Record<string, BillingV2Entitlement>;
+};
+
+export type TCreateBillingV2PortalSessionDTO = {
+ orgId: string;
+ returnPath?: string;
+};
+
+export type TCreateBillingV2CheckoutSessionDTO = {
+ orgId: string;
+ productId: string;
+ cadence?: BillingV2Cadence;
+ email?: string;
+ returnPath?: string;
+};
+
+export type TAddBillingV2PaymentMethodDTO = {
+ orgId: string;
+ returnPath?: string;
+};
diff --git a/frontend/src/hooks/api/index.tsx b/frontend/src/hooks/api/index.tsx
index dd499e9edd..008389655b 100644
--- a/frontend/src/hooks/api/index.tsx
+++ b/frontend/src/hooks/api/index.tsx
@@ -11,6 +11,7 @@ export * from "./assumePrivileges";
export * from "./auditLogs";
export * from "./auditLogStreams";
export * from "./auth";
+export * from "./billingV2";
export * from "./bots";
export * from "./ca";
export * from "./certificateCleanup";
diff --git a/frontend/src/pages/organization/BillingPage/BillingPage.tsx b/frontend/src/pages/organization/BillingPage/BillingPage.tsx
index b8b049a688..c1c8794f35 100644
--- a/frontend/src/pages/organization/BillingPage/BillingPage.tsx
+++ b/frontend/src/pages/organization/BillingPage/BillingPage.tsx
@@ -3,12 +3,18 @@ import { useTranslation } from "react-i18next";
import { OrgPermissionCan } from "@app/components/permissions";
import { PageHeader } from "@app/components/v2";
-import { OrgPermissionBillingActions, OrgPermissionSubjects } from "@app/context";
+import { OrgPermissionBillingActions, OrgPermissionSubjects, useServerConfig } from "@app/context";
+import { BillingV2Page } from "../BillingV2Page";
import { BillingTabGroup } from "./components";
export const BillingPage = () => {
const { t } = useTranslation();
+ const { config } = useServerConfig();
+
+ if (config.licenseServerV2Enabled) {
+ return <BillingV2Page />;
+ }
return (
<div className="h-full bg-bunker-800">
diff --git a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx
new file mode 100644
index 0000000000..5dfcdbcdb8
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx
@@ -0,0 +1,224 @@
+import { ReactNode, useEffect, useState } from "react";
+import { createPortal } from "react-dom";
+import { Helmet } from "react-helmet";
+import { useTranslation } from "react-i18next";
+
+import { createNotification } from "@app/components/notifications";
+import { OrgPermissionCan } from "@app/components/permissions";
+import { PageHeader } from "@app/components/v2";
+import {
+ OrgPermissionBillingActions,
+ OrgPermissionSubjects,
+ useOrganization,
+ useUser
+} from "@app/context";
+import {
+ useAddBillingV2PaymentMethod,
+ useCreateBillingV2CheckoutSession,
+ useCreateBillingV2PortalSession,
+ useGetBillingV2Catalog,
+ useGetBillingV2Overview
+} from "@app/hooks/api";
+
+import { BillingV2RenderState, Overview } from "./components/Overview";
+import { ProductSheet } from "./components/ProductSheet";
+import { catalogById, intervalToCadence } from "./billing-v2-data";
+
+import "./billing-v2.css";
+
+const CONTACT_SALES_URL = "https://infisical.com/talk-to-us";
+
+type BillingV2Flow = { type: "sheet"; prodId: string };
+
+// Overlays render through a portal so fixed positioning is viewport-relative regardless of layout
+// ancestors, while keeping the `.billing-v2` scope that the ported stylesheet targets.
+const Overlay = ({ children }: { children: ReactNode }) =>
+ createPortal(<div className="billing-v2">{children}</div>, document.body);
+
+export const BillingV2Page = () => {
+ const { t } = useTranslation();
+ const { currentOrg } = useOrganization();
+ const { user } = useUser();
+ const orgId = currentOrg?.id ?? "";
+ const billingEmail = user?.email ?? user?.username;
+
+ const { data: overview, isPending, isError, refetch } = useGetBillingV2Overview(orgId);
+ const { data: catalog = [] } = useGetBillingV2Catalog(orgId);
+ const createPortalSession = useCreateBillingV2PortalSession();
+ const createCheckoutSession = useCreateBillingV2CheckoutSession();
+ const addPaymentMethod = useAddBillingV2PaymentMethod();
+
+ const [flow, setFlow] = useState<BillingV2Flow | null>(null);
+
+ // Stripe redirects back with ?checkout=success|canceled; surface the outcome and refresh state.
+ useEffect(() => {
+ const checkout = new URLSearchParams(window.location.search).get("checkout");
+ if (!checkout) {
+ return;
+ }
+ if (checkout === "success") {
+ createNotification({
+ type: "success",
+ text: "Subscription started. It may take a moment to appear here."
+ });
+ refetch();
+ } else if (checkout === "canceled") {
+ createNotification({ type: "info", text: "Checkout was canceled." });
+ }
+ window.history.replaceState({}, "", window.location.pathname);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ let subState: BillingV2RenderState = "loading";
+ if (isError) {
+ subState = "error";
+ } else if (overview) {
+ subState = overview.subState;
+ } else if (isPending) {
+ subState = "loading";
+ }
+
+ const cadence = intervalToCadence(overview?.interval ?? null);
+
+ const close = () => setFlow(null);
+
+ const redirectToPortal = async () => {
+ try {
+ const url = await createPortalSession.mutateAsync({
+ orgId,
+ returnPath: window.location.pathname
+ });
+ window.location.href = url;
+ } catch {
+ createNotification({ type: "error", text: "Failed to open the billing portal." });
+ }
+ };
+
+ const redirectToCheckout = async (productId: string) => {
+ try {
+ const url = await createCheckoutSession.mutateAsync({
+ orgId,
+ productId,
+ cadence,
+ email: billingEmail,
+ returnPath: window.location.pathname
+ });
+ window.location.href = url;
+ } catch {
+ createNotification({ type: "error", text: "Failed to start checkout." });
+ }
+ };
+
+ const onManageSubscription = () => {
+ redirectToPortal();
+ };
+
+ // No subscription yet: open the first purchasable product so the customer can review and check out.
+ const onGetStarted = () => {
+ const startable = catalog.find((product) =>
+ (product.pro?.dims ?? []).some((dim) => dim.monthly > 0 || dim.annual > 0)
+ );
+ const target = startable ?? catalog[0];
+ if (target) {
+ setFlow({ type: "sheet", prodId: target.id });
+ }
+ };
+
+ const onUpgrade = (productId: string) => {
+ setFlow({ type: "sheet", prodId: productId });
+ };
+
+ // From the product sheet: a new customer checks out for that product, an existing one manages in Stripe.
+ const onSheetManage = async (productId: string) => {
+ if (overview?.subState === "no-subscription") {
+ await redirectToCheckout(productId);
+ return;
+ }
+ await redirectToPortal();
+ };
+
+ const onUpdatePayment = async () => {
+ try {
+ const url = await addPaymentMethod.mutateAsync({
+ orgId,
+ returnPath: window.location.pathname
+ });
+ window.location.href = url;
+ } catch {
+ createNotification({ type: "error", text: "Failed to open the payment portal." });
+ }
+ };
+
+ // Billing name/email and address are edited in the Stripe billing portal.
+ const onEditDetails = () => {
+ redirectToPortal();
+ };
+
+ const onContact = () => {
+ window.open(CONTACT_SALES_URL, "_blank", "noopener,noreferrer");
+ };
+
+ const onRetry = () => {
+ refetch();
+ };
+
+ const sheetRedirecting = createPortalSession.isPending || createCheckoutSession.isPending;
+
+ return (
+ <div className="h-full bg-bunker-800">
+ <Helmet>
+ <title>{t("common.head-title", { title: t("billing.title") })}</title>
+ <link rel="icon" href="/infisical.ico" />
+ <meta property="og:image" content="/images/message.png" />
+ </Helmet>
+ <div className="flex h-full w-full justify-center bg-bunker-800 text-white">
+ <div className="w-full max-w-5xl">
+ <PageHeader
+ scope="org"
+ title={t("billing.title")}
+ description="Manage your subscription, products, and payment. Payment is handled securely through Stripe."
+ />
+ <OrgPermissionCan
+ passThrough={false}
+ I={OrgPermissionBillingActions.Read}
+ a={OrgPermissionSubjects.Billing}
+ >
+ <div className="billing-v2">
+ <Overview
+ overview={overview}
+ catalog={catalog}
+ subState={subState}
+ onManageSubscription={onManageSubscription}
+ onUpgrade={onUpgrade}
+ onUpdatePayment={onUpdatePayment}
+ onEditDetails={onEditDetails}
+ onContact={onContact}
+ onGetStarted={onGetStarted}
+ onRetry={onRetry}
+ getStartedLoading={createCheckoutSession.isPending}
+ />
+ </div>
+ </OrgPermissionCan>
+ </div>
+ </div>
+
+ {flow?.type === "sheet" && (
+ <Overlay>
+ <ProductSheet
+ prodId={flow.prodId}
+ prod={catalogById(catalog, flow.prodId)}
+ entitlement={overview?.entitlements[flow.prodId]}
+ cadence={cadence}
+ redirecting={sheetRedirecting}
+ onClose={close}
+ onManage={onSheetManage}
+ onContact={() => {
+ close();
+ onContact();
+ }}
+ />
+ </Overlay>
+ )}
+ </div>
+ );
+};
diff --git a/frontend/src/pages/organization/BillingV2Page/billing-v2-data.ts b/frontend/src/pages/organization/BillingV2Page/billing-v2-data.ts
new file mode 100644
index 0000000000..de37a432a9
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/billing-v2-data.ts
@@ -0,0 +1,43 @@
+import { BillingV2Cadence, BillingV2CatalogProduct, BillingV2Dim } from "@app/hooks/api";
+
+type BillingV2ProBase = { monthly: number; annual: number };
+
+export const catalogById = (
+ catalog: BillingV2CatalogProduct[],
+ id: string
+): BillingV2CatalogProduct | undefined => catalog.find((p) => p.id === id);
+
+export const fmtMoney = (n: number): string => `$${Math.round(Number(n)).toLocaleString("en-US")}`;
+
+export const fmtMoney2 = (n: number): string =>
+ `$${Number(n).toLocaleString("en-US", { minimumFractionDigits: 0, maximumFractionDigits: 2 })}`;
+
+export const cadenceWord = (cad: BillingV2Cadence): string => {
+ if (cad === "annual") {
+ return "year";
+ }
+ return "month";
+};
+
+// Maps the real overview interval onto the catalog cadence used for marketing prices.
+export const intervalToCadence = (interval: "month" | "year" | null): BillingV2Cadence => {
+ if (interval === "year") {
+ return "annual";
+ }
+ return "monthly";
+};
+
+export const intervalWord = (interval: "month" | "year" | null): string => {
+ if (interval === "year") {
+ return "year";
+ }
+ return "month";
+};
+
+// Per-unit price for the active cadence (returns the per-period charge).
+export const unitPrice = (dim: BillingV2Dim | BillingV2ProBase, cad: BillingV2Cadence): number => {
+ if (cad === "annual") {
+ return dim.annual;
+ }
+ return dim.monthly;
+};
diff --git a/frontend/src/pages/organization/BillingV2Page/billing-v2.css b/frontend/src/pages/organization/BillingV2Page/billing-v2.css
new file mode 100644
index 0000000000..1a407596d8
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/billing-v2.css
@@ -0,0 +1,463 @@
+/* Infisical — License v2 billing surface. Scoped under .billing-v2 to avoid global collisions. */
+
+.billing-v2 * { box-sizing: border-box; }
+.billing-v2 a { color: inherit; text-decoration: none; }
+.billing-v2 button { font-family: inherit; }
+.billing-v2 ::selection { background: rgba(48,179,255,0.25); }
+
+/* ---------- BUTTON ---------- */
+.billing-v2 .btn { display:inline-flex; align-items:center; justify-content:center; gap:6px;
+ border:1px solid; border-radius:6px; color:#ebebeb; font-family:inherit;
+ font-size:13px; cursor:pointer; white-space:nowrap;
+ transition: background 200ms, border-color 200ms, transform 80ms; }
+.billing-v2 .btn:active { transform: scale(0.99); }
+.billing-v2 .btn:focus-visible { outline:none; box-shadow:0 0 0 3px rgba(45,47,51,0.6); }
+.billing-v2 .btn:disabled { opacity:0.5; pointer-events:none; }
+.billing-v2 .btn.xs { height:26px; padding:0 8px; font-size:12px; border-radius:4px; }
+.billing-v2 .btn.sm { height:30px; padding:0 10px; font-size:13px; }
+.billing-v2 .btn.md { height:34px; padding:0 13px; font-size:13px; }
+.billing-v2 .btn.lg { height:40px; padding:0 16px; font-size:14px; }
+.billing-v2 .btn.full { width:100%; }
+.billing-v2 .btn .ico { width:14px; height:14px; flex-shrink:0; }
+
+.billing-v2 .btn-outline { background:transparent; border-color:#2b2c30; color:#adaeb0; }
+.billing-v2 .btn-outline:hover { background:rgba(235,235,235,0.05); border-color:#3a3b40; color:#ebebeb; }
+.billing-v2 .btn-ghost { background:transparent; border-color:transparent; color:#adaeb0; }
+.billing-v2 .btn-ghost:hover { background:rgba(235,235,235,0.08); color:#ebebeb; }
+.billing-v2 .btn-neutral { background:rgba(173,174,176,0.10); border-color:rgba(173,174,176,0.25); }
+.billing-v2 .btn-neutral:hover { background:rgba(173,174,176,0.16); }
+.billing-v2 .btn-org { background:rgba(48,179,255,0.10); border-color:rgba(48,179,255,0.28); color:#ebebeb; }
+.billing-v2 .btn-org:hover { background:rgba(48,179,255,0.16); border-color:rgba(48,179,255,0.34); }
+.billing-v2 .btn-success { background:rgba(46,204,113,0.10); border-color:rgba(46,204,113,0.25); }
+.billing-v2 .btn-success:hover { background:rgba(46,204,113,0.16); }
+.billing-v2 .btn-info { background:rgba(99,176,189,0.10); border-color:rgba(99,176,189,0.25); }
+.billing-v2 .btn-warning { background:rgba(241,196,15,0.10); border-color:rgba(241,196,15,0.28); }
+.billing-v2 .btn-warning:hover { background:rgba(241,196,15,0.16); }
+.billing-v2 .btn-danger { background:rgba(231,76,60,0.10); border-color:rgba(231,76,60,0.28); }
+.billing-v2 .btn-danger:hover { background:rgba(231,76,60,0.16); border-color:rgba(231,76,60,0.34); }
+
+.billing-v2 .icon-btn { display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px;
+ border-radius:6px; background:transparent; border:1px solid transparent; color:#7d7f80; cursor:pointer;
+ transition:all 200ms; flex-shrink:0; }
+.billing-v2 .icon-btn:hover { background:rgba(235,235,235,0.06); color:#ebebeb; }
+
+/* ---------- BADGE ---------- */
+.billing-v2 .badge { display:inline-flex; align-items:center; gap:4px; height:20px; padding:0 7px; font-size:11px;
+ border-radius:4px; border:1px solid; line-height:1; white-space:nowrap; font-weight:500; }
+.billing-v2 .badge .ico { width:11px; height:11px; }
+.billing-v2 .badge .dot { width:6px; height:6px; border-radius:50%; background:currentColor; }
+.billing-v2 .badge-neutral { background:rgba(173,174,176,0.15); border-color:rgba(173,174,176,0.10); color:#adaeb0; }
+.billing-v2 .badge-success { background:rgba(46,204,113,0.15); border-color:rgba(46,204,113,0.12); color:#2ecc71; }
+.billing-v2 .badge-info { background:rgba(99,176,189,0.15); border-color:rgba(99,176,189,0.12); color:#63b0bd; }
+.billing-v2 .badge-warning { background:rgba(241,196,15,0.15); border-color:rgba(241,196,15,0.12); color:#f1c40f; }
+.billing-v2 .badge-danger { background:rgba(231,76,60,0.15); border-color:rgba(231,76,60,0.12); color:#e74c3c; }
+.billing-v2 .badge-org { background:rgba(48,179,255,0.15); border-color:rgba(48,179,255,0.12); color:#30b3ff; }
+.billing-v2 .badge-outline { background:transparent; border-color:#2b2c30; color:#adaeb0; }
+
+/* ---------- CARD ---------- */
+.billing-v2 .card { background:#16181a; border:1px solid #2b2c30; border-radius:8px; padding:20px;
+ display:flex; flex-direction:column; gap:18px; box-shadow:0 1px 2px rgba(0,0,0,0.3); }
+.billing-v2 .card.no-pad { padding:0; gap:0; }
+.billing-v2 .card-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
+.billing-v2 .card-title { font-size:16px; font-weight:600; line-height:1.1; color:#ebebeb; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
+.billing-v2 .card-desc { font-size:13px; color:#7d7f80; margin-top:6px; line-height:1.5; }
+
+/* ---------- INPUT ---------- */
+.billing-v2 .input { display:block; width:100%; height:34px; padding:0 12px; border:1px solid #2b2c30;
+ background:#141617; color:#ebebeb; border-radius:6px; font-size:13px; font-family:inherit;
+ transition:border-color 200ms, box-shadow 200ms; }
+.billing-v2 .input::placeholder { color:#707174; }
+.billing-v2 .input:focus { outline:none; border-color:#2d2f33; box-shadow:0 0 0 3px rgba(45,47,51,0.5); }
+.billing-v2 .field-label { font-size:12px; color:#adaeb0; margin-bottom:6px; display:block; }
+.billing-v2 .field-desc { font-size:12px; color:#707174; margin-top:5px; line-height:1.5; }
+
+/* ---------- PAGE DESC ---------- */
+.billing-v2 .page-desc { font-size:13px; color:#adaeb0; margin-top:7px; line-height:1.55; max-width:56ch; }
+
+/* ---------- STACK ---------- */
+.billing-v2 .stack { display:flex; flex-direction:column; gap:18px; }
+
+/* ====================================================================== */
+/* ==================== BILLING-SPECIFIC ============================== */
+/* ====================================================================== */
+
+/* ---------- Summary header card ---------- */
+.billing-v2 .summary { display:flex; flex-direction:column; gap:0; padding:0; overflow:hidden; }
+.billing-v2 .summary-top { display:flex; align-items:stretch; gap:0; flex-wrap:wrap; }
+.billing-v2 .summary-metric { flex:1; min-width:180px; padding:22px 24px; display:flex; flex-direction:column; gap:8px;
+ border-right:1px solid #2b2c30; }
+.billing-v2 .summary-metric:last-child { border-right:none; }
+.billing-v2 .summary-metric .lbl { font-size:11px; text-transform:uppercase; letter-spacing:0.06em; color:#707174; font-weight:500; }
+.billing-v2 .summary-metric .val { font-size:24px; font-weight:600; color:#fff; line-height:1.1; letter-spacing:-0.01em; }
+.billing-v2 .summary-metric .val .cadence { font-size:14px; font-weight:400; color:#adaeb0; letter-spacing:0; }
+.billing-v2 .summary-metric .sub { font-size:12px; color:#7d7f80; }
+.billing-v2 .summary-note { padding:12px 24px; border-top:1px solid #2b2c30; background:rgba(48,179,255,0.04);
+ font-size:12.5px; color:#9fa1a4; display:flex; align-items:center; gap:8px; }
+.billing-v2 .summary-note .ico { color:#30b3ff; width:14px; height:14px; flex-shrink:0; }
+
+/* ---------- Product rows / cards ---------- */
+.billing-v2 .prod-list { display:flex; flex-direction:column; }
+.billing-v2 .prod-item { padding:16px 4px; border-top:1px solid #2b2c30; }
+.billing-v2 .prod-item:first-child { border-top:none; }
+.billing-v2 .prod-row { display:flex; align-items:center; gap:16px; }
+.billing-v2 .prod-row.paused { opacity:0.62; }
+.billing-v2 .prod-row.paused .prod-ico { filter:grayscale(0.6); }
+.billing-v2 .prod-ico { width:38px; height:38px; border-radius:8px; display:flex; align-items:center; justify-content:center;
+ flex-shrink:0; border:1px solid; }
+.billing-v2 .prod-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
+.billing-v2 .prod-name-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
+.billing-v2 .prod-name { font-size:14.5px; font-weight:600; color:#ebebeb; }
+.billing-v2 .prod-plan-chip { font-size:11px; color:#adaeb0; background:rgba(173,174,176,0.10); border:1px solid rgba(173,174,176,0.18);
+ padding:1px 7px; border-radius:4px; font-weight:500; white-space:nowrap; }
+.billing-v2 .prod-meta { font-size:12.5px; color:#7d7f80; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
+.billing-v2 .prod-meta .sep { color:#3a3b40; }
+.billing-v2 .prod-price { text-align:right; flex-shrink:0; display:flex; flex-direction:column; gap:2px; }
+.billing-v2 .prod-price .amt { font-size:14px; font-weight:600; color:#ebebeb; }
+.billing-v2 .prod-price .amt .cadence { font-size:12px; font-weight:400; color:#7d7f80; }
+.billing-v2 .prod-actions { display:flex; align-items:center; gap:6px; flex-shrink:0; }
+
+/* ---------- Generic info rows (payment, billing details) ---------- */
+.billing-v2 .info-row { display:flex; align-items:center; justify-content:space-between; gap:16px; }
+.billing-v2 .info-pair { display:flex; align-items:center; gap:14px; }
+.billing-v2 .card-brand { width:46px; height:30px; border-radius:5px; border:1px solid #2b2c30; background:#1a1c1e;
+ display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; letter-spacing:0.03em; color:#ebebeb; flex-shrink:0; }
+.billing-v2 .info-text .t1 { font-size:13.5px; color:#ebebeb; font-weight:500; }
+.billing-v2 .info-text .t2 { font-size:12px; color:#7d7f80; margin-top:2px; }
+.billing-v2 .detail-grid { display:grid; grid-template-columns:repeat(3, 1fr); gap:18px; }
+.billing-v2 .detail-cell .dk { font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:#707174; margin-bottom:5px; }
+.billing-v2 .detail-cell .dv { font-size:13.5px; color:#ebebeb; }
+.billing-v2 .detail-cell .dv.mono { font-family:ui-monospace,"SF Mono",Menlo,monospace; font-size:12.5px; }
+
+/* ---------- Invoices table ---------- */
+.billing-v2 .inv-tbl { width:100%; border-collapse:collapse; }
+.billing-v2 .inv-tbl thead th { text-align:left; padding:0 4px 10px; font-size:11px; font-weight:500; color:#707174;
+ text-transform:uppercase; letter-spacing:0.05em; border-bottom:1px solid #2b2c30; }
+.billing-v2 .inv-tbl thead th.right { text-align:right; }
+.billing-v2 .inv-tbl tbody td { padding:13px 4px; font-size:13px; color:#ebebeb; border-bottom:1px solid #222327; vertical-align:middle; }
+.billing-v2 .inv-tbl tbody tr:last-child td { border-bottom:none; }
+.billing-v2 .inv-tbl td.right { text-align:right; }
+.billing-v2 .inv-tbl td.mono { font-family:ui-monospace,"SF Mono",Menlo,monospace; font-size:12.5px; color:#adaeb0; }
+.billing-v2 .inv-dl { color:#30b3ff; cursor:pointer; display:inline-flex; align-items:center; gap:5px; font-size:12.5px; }
+.billing-v2 .inv-dl:hover { text-decoration:underline; }
+.billing-v2 .empty-row { padding:28px; text-align:center; color:#707174; font-size:13px; }
+
+/* ---------- Banners ---------- */
+.billing-v2 .banner { display:flex; align-items:flex-start; gap:13px; padding:14px 16px; border-radius:8px; border:1px solid;
+ margin-bottom:22px; }
+.billing-v2 .banner .b-ico { width:20px; height:20px; flex-shrink:0; margin-top:1px; }
+.billing-v2 .banner .b-body { flex:1; min-width:0; }
+.billing-v2 .banner .b-title { font-size:13.5px; font-weight:600; margin-bottom:3px; }
+.billing-v2 .banner .b-text { font-size:12.5px; line-height:1.5; }
+.billing-v2 .banner .b-actions { display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; }
+.billing-v2 .banner-warning { background:rgba(241,196,15,0.07); border-color:rgba(241,196,15,0.28); }
+.billing-v2 .banner-warning .b-ico, .billing-v2 .banner-warning .b-title { color:#f1c40f; }
+.billing-v2 .banner-warning .b-text { color:#cdb86a; }
+.billing-v2 .banner-danger { background:rgba(231,76,60,0.08); border-color:rgba(231,76,60,0.30); }
+.billing-v2 .banner-danger .b-ico, .billing-v2 .banner-danger .b-title { color:#e74c3c; }
+.billing-v2 .banner-danger .b-text { color:#d39189; }
+.billing-v2 .banner-info { background:rgba(99,176,189,0.07); border-color:rgba(99,176,189,0.26); }
+.billing-v2 .banner-info .b-ico, .billing-v2 .banner-info .b-title { color:#63b0bd; }
+.billing-v2 .banner-info .b-text { color:#92b3ba; }
+
+/* ---------- Get-started / empty ---------- */
+.billing-v2 .getstarted { display:flex; flex-direction:column; align-items:center; text-align:center; gap:16px;
+ padding:52px 28px; }
+.billing-v2 .getstarted .gs-ico { width:54px; height:54px; border-radius:12px; display:flex; align-items:center; justify-content:center;
+ background:rgba(48,179,255,0.10); border:1px solid rgba(48,179,255,0.25); color:#30b3ff; }
+.billing-v2 .getstarted .gs-title { font-size:18px; font-weight:600; color:#fff; }
+.billing-v2 .getstarted .gs-text { font-size:13.5px; color:#9fa1a4; max-width:42ch; line-height:1.6; }
+
+/* ---------- Inline error panel ---------- */
+.billing-v2 .err-panel { display:flex; flex-direction:column; align-items:center; text-align:center; gap:12px; padding:40px 28px; }
+.billing-v2 .err-panel .e-ico { color:#e74c3c; }
+.billing-v2 .err-panel .e-title { font-size:15px; font-weight:600; color:#ebebeb; }
+.billing-v2 .err-panel .e-text { font-size:13px; color:#9fa1a4; max-width:40ch; line-height:1.55; }
+
+/* ---------- Skeletons ---------- */
+.billing-v2 .sk { background:linear-gradient(90deg, #1c1e21 25%, #232529 50%, #1c1e21 75%); background-size:200% 100%;
+ animation:bv2-sk-shimmer 1.4s ease-in-out infinite; border-radius:5px; }
+@keyframes bv2-sk-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
+
+/* ---------- Modal / Dialog ---------- */
+.billing-v2 .modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:60;
+ display:flex; align-items:center; justify-content:center; padding:24px; animation:bv2-fade 180ms ease-out; }
+.billing-v2 .modal { background:#141617; border:1px solid #2b2c30; border-radius:10px; box-shadow:0 10px 40px rgba(0,0,0,0.55);
+ width:480px; max-width:100%; max-height:calc(100vh - 48px); display:flex; flex-direction:column; overflow:hidden;
+ animation:bv2-pop 180ms cubic-bezier(0.16,1,0.3,1); }
+.billing-v2 .modal.wide { width:760px; }
+.billing-v2 .modal-head { padding:18px 20px 16px; border-bottom:1px solid #2b2c30; display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
+.billing-v2 .modal-head .m-title { font-size:16px; font-weight:600; color:#fff; }
+.billing-v2 .modal-head .m-desc { font-size:12.5px; color:#7d7f80; margin-top:4px; line-height:1.5; }
+.billing-v2 .modal-body { padding:20px; overflow-y:auto; flex:1; }
+.billing-v2 .modal-foot { padding:14px 20px; border-top:1px solid #2b2c30; display:flex; gap:10px; justify-content:flex-end; align-items:center; }
+.billing-v2 .modal-foot .foot-note { margin-right:auto; font-size:12px; color:#707174; }
+@keyframes bv2-fade { from{opacity:0} to{opacity:1} }
+@keyframes bv2-pop { from{opacity:0; transform:scale(0.97) translateY(6px)} to{opacity:1; transform:none} }
+
+/* ---------- Catalog cards ---------- */
+.billing-v2 .catalog-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
+@media (max-width:680px){ .billing-v2 .catalog-grid{ grid-template-columns:1fr; } }
+.billing-v2 .cat-card { border:1px solid #2b2c30; border-radius:9px; background:#16181a; padding:16px;
+ display:flex; flex-direction:column; gap:13px; transition:border-color 200ms, background 200ms; }
+.billing-v2 .cat-card.added { border-color:rgba(46,204,113,0.30); background:rgba(46,204,113,0.03); }
+.billing-v2 .cat-card.selected { border-color:rgba(48,179,255,0.45); background:rgba(48,179,255,0.05); }
+.billing-v2 .cat-head { display:flex; gap:12px; align-items:flex-start; }
+.billing-v2 .cat-head .prod-ico { width:34px; height:34px; }
+.billing-v2 .cat-titles { flex:1; min-width:0; }
+.billing-v2 .cat-name { font-size:14px; font-weight:600; color:#ebebeb; display:flex; align-items:center; gap:8px; }
+.billing-v2 .cat-desc { font-size:12.5px; color:#7d7f80; margin-top:4px; line-height:1.5; }
+.billing-v2 .cat-plans { display:flex; flex-direction:column; gap:8px; }
+.billing-v2 .plan-opt { display:flex; align-items:center; gap:11px; padding:10px 12px; border:1px solid #2b2c30; border-radius:7px;
+ cursor:pointer; transition:border-color 150ms, background 150ms; background:#141617; }
+.billing-v2 .plan-opt:hover { border-color:#3a3b40; }
+.billing-v2 .plan-opt.sel { border-color:rgba(48,179,255,0.5); background:rgba(48,179,255,0.06); }
+.billing-v2 .plan-opt.disabled { opacity:0.55; cursor:default; }
+.billing-v2 .plan-radio { width:16px; height:16px; border-radius:50%; border:1.5px solid #3a3b40; flex-shrink:0; position:relative; }
+.billing-v2 .plan-opt.sel .plan-radio { border-color:#30b3ff; }
+.billing-v2 .plan-opt.sel .plan-radio::after { content:""; position:absolute; inset:3px; border-radius:50%; background:#30b3ff; }
+.billing-v2 .plan-info { flex:1; min-width:0; }
+.billing-v2 .plan-name { font-size:13px; font-weight:500; color:#ebebeb; }
+.billing-v2 .plan-feat { font-size:11.5px; color:#707174; margin-top:2px; }
+.billing-v2 .plan-price { text-align:right; flex-shrink:0; font-size:13px; font-weight:600; color:#ebebeb; }
+.billing-v2 .plan-price .cadence { font-size:11px; font-weight:400; color:#7d7f80; }
+.billing-v2 .plan-price.sales { font-size:12px; font-weight:500; color:#63b0bd; }
+.billing-v2 .cat-foot { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:2px; }
+
+/* ---------- Preset bundle ---------- */
+.billing-v2 .preset { display:flex; align-items:center; gap:14px; padding:14px 16px; border-radius:9px;
+ border:1px dashed rgba(48,179,255,0.35); background:rgba(48,179,255,0.04); margin-bottom:16px; }
+.billing-v2 .preset .p-ico { width:36px; height:36px; border-radius:8px; background:rgba(48,179,255,0.12);
+ border:1px solid rgba(48,179,255,0.25); color:#30b3ff; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
+.billing-v2 .preset .p-body { flex:1; }
+.billing-v2 .preset .p-title { font-size:13.5px; font-weight:600; color:#ebebeb; }
+.billing-v2 .preset .p-text { font-size:12px; color:#8a8c8f; margin-top:2px; }
+
+/* ---------- Cart summary (checkout) ---------- */
+.billing-v2 .cart { border:1px solid #2b2c30; border-radius:9px; background:#16181a; padding:16px; display:flex; flex-direction:column; gap:12px; }
+.billing-v2 .cart-title { font-size:13px; font-weight:600; color:#ebebeb; text-transform:uppercase; letter-spacing:0.04em; }
+.billing-v2 .cart-line { display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:13px; }
+.billing-v2 .cart-line .cl-name { color:#cfd0d2; display:flex; align-items:center; gap:7px; }
+.billing-v2 .cart-line .cl-amt { color:#ebebeb; font-weight:500; white-space:nowrap; }
+.billing-v2 .cart-line.muted .cl-name, .billing-v2 .cart-line.muted .cl-amt { color:#8a8c8f; font-weight:400; }
+.billing-v2 .cart-divider { height:1px; background:#2b2c30; margin:2px 0; }
+.billing-v2 .cart-total { display:flex; align-items:center; justify-content:space-between; }
+.billing-v2 .cart-total .ct-lbl { font-size:13px; color:#adaeb0; }
+.billing-v2 .cart-total .ct-amt { font-size:18px; font-weight:600; color:#fff; }
+.billing-v2 .cart-total .ct-amt .cadence { font-size:12px; font-weight:400; color:#7d7f80; }
+.billing-v2 .cart-empty { font-size:12.5px; color:#707174; text-align:center; padding:14px 0; }
+
+/* ---------- Stepper ---------- */
+.billing-v2 .stepper { display:flex; align-items:center; gap:0; margin-bottom:4px; }
+.billing-v2 .step { display:flex; align-items:center; gap:9px; }
+.billing-v2 .step .sdot { width:24px; height:24px; border-radius:50%; border:1.5px solid #2b2c30; display:flex; align-items:center; justify-content:center;
+ font-size:12px; font-weight:600; color:#707174; flex-shrink:0; transition:all 200ms; }
+.billing-v2 .step.active .sdot { border-color:#30b3ff; color:#30b3ff; background:rgba(48,179,255,0.10); }
+.billing-v2 .step.done .sdot { border-color:#2ecc71; background:#2ecc71; color:#0e1014; }
+.billing-v2 .step .slbl { font-size:12.5px; color:#707174; white-space:nowrap; }
+.billing-v2 .step.active .slbl { color:#ebebeb; font-weight:500; }
+.billing-v2 .step.done .slbl { color:#adaeb0; }
+.billing-v2 .step-line { flex:1; height:1px; background:#2b2c30; margin:0 12px; min-width:18px; }
+.billing-v2 .step-line.done { background:rgba(46,204,113,0.4); }
+
+/* ---------- Review line items ---------- */
+.billing-v2 .review-list { display:flex; flex-direction:column; border:1px solid #2b2c30; border-radius:8px; overflow:hidden; }
+.billing-v2 .review-line { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 15px; border-top:1px solid #222327; }
+.billing-v2 .review-line:first-child { border-top:none; }
+.billing-v2 .review-line .rl-name { font-size:13px; color:#ebebeb; display:flex; align-items:center; gap:9px; }
+.billing-v2 .review-line .rl-sub { font-size:11.5px; color:#707174; margin-top:1px; }
+.billing-v2 .review-line .rl-amt { font-size:13px; color:#ebebeb; font-weight:500; white-space:nowrap; }
+.billing-v2 .review-totals { background:#141617; padding:14px 15px; display:flex; flex-direction:column; gap:9px; border-top:1px solid #2b2c30; }
+
+/* ---------- Embedded payment region ---------- */
+.billing-v2 .pay-region { border:1px solid #2b2c30; border-radius:8px; background:#141617; padding:16px; position:relative; }
+.billing-v2 .pay-region-badge { position:absolute; top:-9px; right:14px; font-size:10px; color:#707174; background:#141617;
+ padding:0 7px; display:inline-flex; align-items:center; gap:5px; }
+.billing-v2 .pay-region-badge .ico { width:11px; height:11px; }
+.billing-v2 .pay-field { display:flex; flex-direction:column; gap:6px; margin-bottom:13px; }
+.billing-v2 .pay-field:last-child { margin-bottom:0; }
+.billing-v2 .pay-field label { font-size:11.5px; color:#8a8c8f; }
+.billing-v2 .pay-input { height:38px; border:1px solid #2b2c30; border-radius:7px; background:#16181a; display:flex; align-items:center;
+ padding:0 12px; gap:8px; font-size:13px; color:#ebebeb; }
+.billing-v2 .pay-input .pi-dots { letter-spacing:2px; color:#cfd0d2; font-family:ui-monospace,Menlo,monospace; }
+.billing-v2 .pay-input .pi-placeholder { color:#55575b; }
+.billing-v2 .pay-input .brand-mini { margin-left:auto; font-size:10px; font-weight:700; color:#707174; }
+.billing-v2 .pay-row { display:flex; gap:12px; }
+.billing-v2 .pay-row .pay-field { flex:1; }
+
+/* ---------- What-changes list ---------- */
+.billing-v2 .changes { display:flex; flex-direction:column; gap:9px; }
+.billing-v2 .change-item { display:flex; gap:10px; align-items:flex-start; font-size:12.5px; line-height:1.5; }
+.billing-v2 .change-item .ci-ico { width:16px; height:16px; flex-shrink:0; margin-top:1px; }
+.billing-v2 .change-item.add .ci-ico { color:#2ecc71; }
+.billing-v2 .change-item.remove .ci-ico { color:#e74c3c; }
+.billing-v2 .change-item .ci-text { color:#c4c5c7; }
+
+/* ---------- Proration preview box ---------- */
+.billing-v2 .proration { border:1px solid #2b2c30; border-radius:8px; overflow:hidden; }
+.billing-v2 .proration-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 15px; }
+.billing-v2 .proration-row.hl { background:rgba(48,179,255,0.05); }
+.billing-v2 .proration-row + .proration-row { border-top:1px solid #2b2c30; }
+.billing-v2 .proration-row .pr-lbl { font-size:13px; color:#adaeb0; }
+.billing-v2 .proration-row .pr-lbl .pr-sub { font-size:11.5px; color:#707174; margin-top:2px; }
+.billing-v2 .proration-row .pr-amt { font-size:15px; font-weight:600; color:#ebebeb; white-space:nowrap; }
+.billing-v2 .proration-row.hl .pr-amt { color:#30b3ff; }
+
+/* ---------- 3DS auth interstitial ---------- */
+.billing-v2 .auth-body { display:flex; flex-direction:column; align-items:center; text-align:center; gap:18px; padding:34px 24px; }
+.billing-v2 .auth-bank { width:54px; height:54px; border-radius:12px; background:#1a1c1e; border:1px solid #2b2c30;
+ display:flex; align-items:center; justify-content:center; color:#63b0bd; }
+.billing-v2 .auth-title { font-size:15px; font-weight:600; color:#ebebeb; }
+.billing-v2 .auth-text { font-size:13px; color:#9fa1a4; max-width:34ch; line-height:1.55; }
+
+/* ---------- Spinner ---------- */
+.billing-v2 .spin { width:16px; height:16px; border:2px solid rgba(235,235,235,0.2); border-top-color:#ebebeb; border-radius:50%;
+ animation:bv2-spin 0.7s linear infinite; display:inline-block; }
+.billing-v2 .spin.lg { width:30px; height:30px; border-width:3px; }
+.billing-v2 .spin.org { border-top-color:#30b3ff; }
+@keyframes bv2-spin { to{ transform:rotate(360deg); } }
+
+/* ---------- Confirmation ---------- */
+.billing-v2 .confirm-body { display:flex; flex-direction:column; align-items:center; text-align:center; gap:16px; padding:36px 24px 28px; }
+.billing-v2 .confirm-check { width:56px; height:56px; border-radius:50%; background:rgba(46,204,113,0.12); border:1px solid rgba(46,204,113,0.3);
+ display:flex; align-items:center; justify-content:center; color:#2ecc71; }
+.billing-v2 .confirm-title { font-size:18px; font-weight:600; color:#fff; }
+.billing-v2 .confirm-text { font-size:13.5px; color:#9fa1a4; line-height:1.6; max-width:40ch; }
+.billing-v2 .confirm-list { width:100%; border:1px solid #2b2c30; border-radius:8px; overflow:hidden; margin-top:4px; }
+
+/* ---------- Misc ---------- */
+.billing-v2 .hint { font-size:12px; color:#707174; line-height:1.5; }
+.billing-v2 .mono { font-family:ui-monospace,"SF Mono",Menlo,monospace; }
+.billing-v2 .row-link { color:#30b3ff; cursor:pointer; font-size:12.5px; }
+.billing-v2 .row-link:hover { text-decoration:underline; }
+.billing-v2 .divider { height:1px; background:#2b2c30; }
+
+/* ---------- Usage meters ---------- */
+.billing-v2 .prod-usage { display:flex; flex-direction:column; gap:9px; margin-top:10px; }
+.billing-v2 .meter { display:flex; flex-direction:column; gap:5px; }
+.billing-v2 .meter-top { display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
+.billing-v2 .meter-label { font-size:12px; color:#9fa1a4; white-space:nowrap; }
+.billing-v2 .meter-count { font-size:12px; color:#ebebeb; font-variant-numeric:tabular-nums; white-space:nowrap; }
+.billing-v2 .meter-count .meter-cap { color:#707174; }
+.billing-v2 .meter-count .meter-rate { color:#707174; }
+.billing-v2 .meter-count.tone-near { color:#f1c40f; }
+.billing-v2 .meter-count.tone-full { color:#e74c3c; }
+.billing-v2 .meter-track { height:5px; border-radius:3px; background:#26282c; overflow:hidden; }
+.billing-v2 .meter-fill { height:100%; border-radius:3px; background:#30b3ff; transition:width 300ms ease; }
+.billing-v2 .meter-fill.tone-near { background:#f1c40f; }
+.billing-v2 .meter-fill.tone-full { background:#e74c3c; }
+.billing-v2 .limit-note { display:flex; align-items:center; gap:7px; font-size:12px; margin-top:9px;
+ padding:8px 11px; border-radius:6px; }
+.billing-v2 .limit-note.near { background:rgba(241,196,15,0.07); border:1px solid rgba(241,196,15,0.22); color:#cdb86a; }
+.billing-v2 .limit-note.full { background:rgba(231,76,60,0.07); border:1px solid rgba(231,76,60,0.24); color:#d39189; }
+.billing-v2 .limit-note .ico { flex-shrink:0; }
+
+/* ---------- Cost block (MTD + projected) ---------- */
+.billing-v2 .cost-block { display:flex; flex-direction:column; gap:3px; }
+.billing-v2 .cost-mtd { font-size:24px; font-weight:600; color:#fff; line-height:1.1; letter-spacing:-0.01em; }
+.billing-v2 .cost-proj { font-size:12px; color:#7d7f80; }
+.billing-v2 .cost-proj strong { color:#adaeb0; font-weight:500; }
+
+/* ---------- Per-product price column ---------- */
+.billing-v2 .prod-price .breakdown { font-size:11px; color:#707174; margin-top:2px; line-height:1.4; }
+.billing-v2 .prod-price .model-chip { display:inline-flex; align-items:center; height:17px; padding:0 6px; border-radius:3px;
+ font-size:10px; font-weight:500; letter-spacing:0.02em; background:rgba(173,174,176,0.10);
+ border:1px solid rgba(173,174,176,0.16); color:#8a8c8f; text-transform:uppercase; }
+
+/* ====================================================================== */
+/* ==================== RIGHT-SIDE SHEET ============================== */
+/* ====================================================================== */
+.billing-v2 .sheet-backdrop { position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:60; animation:bv2-fade 180ms ease-out; }
+.billing-v2 .sheet { position:fixed; top:0; right:0; height:100vh; width:780px; max-width:100%; background:#141617;
+ border-left:1px solid #2b2c30; box-shadow:-14px 0 50px rgba(0,0,0,0.5); z-index:61;
+ display:flex; flex-direction:column; animation:bv2-sheet-in 240ms cubic-bezier(0.16,1,0.3,1); }
+@keyframes bv2-sheet-in { from{ transform:translateX(48px); opacity:0.3 } to{ transform:none; opacity:1 } }
+@media (max-width:840px){ .billing-v2 .sheet{ width:100%; } }
+.billing-v2 .sheet-head { padding:18px 22px; border-bottom:1px solid #2b2c30; display:flex; align-items:flex-start; gap:14px; flex-shrink:0; }
+.billing-v2 .sheet-head .prod-ico { width:40px; height:40px; }
+.billing-v2 .sh-titles { flex:1; min-width:0; }
+.billing-v2 .sheet-title { font-size:17px; font-weight:600; color:#fff; line-height:1.2; display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
+.billing-v2 .sheet-sub { font-size:12.5px; color:#7d7f80; margin-top:5px; line-height:1.5; max-width:62ch; }
+.billing-v2 .sheet-body { flex:1; overflow-y:auto; padding:22px; display:flex; flex-direction:column; gap:24px; }
+.billing-v2 .sheet-foot { padding:14px 22px; border-top:1px solid #2b2c30; display:flex; gap:10px; align-items:center; justify-content:flex-end; flex-shrink:0; }
+.billing-v2 .sheet-foot .foot-note { margin-right:auto; font-size:12px; color:#707174; }
+.billing-v2 .sheet-back { display:inline-flex; align-items:center; gap:5px; font-size:12.5px; color:#8a8c8f; cursor:pointer;
+ background:none; border:none; padding:0; margin-right:auto; font-family:inherit; }
+.billing-v2 .sheet-back:hover { color:#ebebeb; }
+
+/* ---------- Tier cards (pricing-page style, per product) ---------- */
+.billing-v2 .tier-cards { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
+.billing-v2 .tier-cards.single { grid-template-columns:1fr; }
+@media (max-width:640px){ .billing-v2 .tier-cards{ grid-template-columns:1fr; } }
+.billing-v2 .tier-card { border:1px solid #2b2c30; border-radius:10px; background:#16181a; padding:18px;
+ display:flex; flex-direction:column; gap:14px; position:relative; transition:border-color 200ms, background 200ms; }
+.billing-v2 .tier-card.featured { border-color:rgba(48,179,255,0.42); background:rgba(48,179,255,0.045); }
+.billing-v2 .tier-card.current { border-color:rgba(173,174,176,0.30); background:rgba(173,174,176,0.04); }
+.billing-v2 .tier-top { display:flex; align-items:center; justify-content:space-between; gap:8px; }
+.billing-v2 .tier-name { font-size:15px; font-weight:600; color:#fff; }
+.billing-v2 .tier-price { display:flex; align-items:baseline; gap:7px; flex-wrap:wrap; min-height:30px; }
+.billing-v2 .tier-price .tp-amt { font-size:26px; font-weight:600; color:#fff; letter-spacing:-0.02em; line-height:1; }
+.billing-v2 .tier-price .tp-unit { font-size:12px; color:#7d7f80; }
+.billing-v2 .tier-desc { font-size:12.5px; color:#9fa1a4; line-height:1.55; flex:1; }
+.billing-v2 .tier-cta { margin-top:2px; }
+
+/* ---------- Comparison table ---------- */
+.billing-v2 .cmp-h { font-size:12px; font-weight:600; color:#8a8c8f; text-transform:uppercase; letter-spacing:0.06em; margin-bottom:12px; }
+.billing-v2 .cmp-wrap { border:1px solid #2b2c30; border-radius:8px; overflow:hidden; }
+.billing-v2 .cmp-table { width:100%; border-collapse:collapse; }
+.billing-v2 .cmp-table th, .billing-v2 .cmp-table td { padding:11px 16px; text-align:left; font-size:12.5px; vertical-align:middle; }
+.billing-v2 .cmp-table tbody tr { border-top:1px solid #222327; }
+.billing-v2 .cmp-table thead th { background:#16181a; font-size:11px; text-transform:uppercase; letter-spacing:0.05em;
+ color:#707174; font-weight:500; border-bottom:1px solid #2b2c30; }
+.billing-v2 .cmp-table th.col, .billing-v2 .cmp-table td.col { text-align:center; width:150px; }
+.billing-v2 .cmp-table thead th.col .ch-name { color:#ebebeb; font-size:12px; font-weight:600; text-transform:none; letter-spacing:0; }
+.billing-v2 .cmp-table thead th.col .ch-name.org { color:#30b3ff; }
+.billing-v2 .cmp-table thead th.col .ch-name.ent { color:#63b0bd; }
+.billing-v2 .cmp-table .feat { color:#cfd0d2; }
+.billing-v2 .cmp-table td.col { color:#dfe0e2; font-variant-numeric:tabular-nums; }
+.billing-v2 .cmp-table td.col.ent, .billing-v2 .cmp-table th.col.ent { background:rgba(99,176,189,0.035); }
+.billing-v2 .cmp-table tbody tr:hover { background:rgba(235,235,235,0.02); }
+.billing-v2 .cmp-check { color:#2ecc71; display:inline-flex; }
+.billing-v2 .cmp-dash { color:#54565a; }
+
+/* ---------- Included-features list (add-ons w/ no Enterprise) ---------- */
+.billing-v2 .incl-list { display:grid; grid-template-columns:1fr 1fr; gap:11px 20px; }
+@media (max-width:560px){ .billing-v2 .incl-list{ grid-template-columns:1fr; } }
+.billing-v2 .incl-item { display:flex; gap:9px; align-items:flex-start; font-size:12.5px; color:#c4c5c7; line-height:1.5; }
+.billing-v2 .incl-item .ci-ico { width:15px; height:15px; flex-shrink:0; margin-top:2px; color:#2ecc71; }
+
+/* ---------- Sheet: current-usage strip (owned products) ---------- */
+.billing-v2 .sheet-usage { border:1px solid #2b2c30; border-radius:8px; background:#16181a; padding:16px; }
+.billing-v2 .sheet-usage .su-top { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:13px; }
+.billing-v2 .sheet-usage .su-lbl { font-size:12px; color:#adaeb0; font-weight:500; white-space:nowrap; }
+.billing-v2 .sheet-usage .su-amt { font-size:13px; color:#ebebeb; font-weight:600; white-space:nowrap; flex-shrink:0; }
+.billing-v2 .sheet-usage .su-amt .cadence { font-size:11px; font-weight:400; color:#7d7f80; }
+
+/* ---------- Available products section header ---------- */
+.billing-v2 .avail-intro { display:flex; flex-direction:column; align-items:center; text-align:center; gap:8px; padding:8px 20px 22px; }
+.billing-v2 .avail-intro .ai-ico { width:48px; height:48px; border-radius:11px; display:flex; align-items:center; justify-content:center;
+ background:rgba(48,179,255,0.10); border:1px solid rgba(48,179,255,0.25); color:#30b3ff; margin-bottom:4px; }
+.billing-v2 .avail-intro .ai-title { font-size:17px; font-weight:600; color:#fff; }
+.billing-v2 .avail-intro .ai-text { font-size:13px; color:#9fa1a4; max-width:46ch; line-height:1.6; }
+.billing-v2 .section-label { font-size:11px; text-transform:uppercase; letter-spacing:0.06em; color:#707174; font-weight:600;
+ margin:2px 0 -4px; }
+
+/* ---------- Available rows (within the Products card) ---------- */
+.billing-v2 .avail-sep { font-size:11px; text-transform:uppercase; letter-spacing:0.06em; color:#707174; font-weight:600;
+ padding:18px 0 12px; border-top:1px solid #2b2c30; margin-top:6px; }
+.billing-v2 .avail-sep + .prod-item { border-top:none; }
+.billing-v2 .prod-item.avail .prod-meta { color:#8a8c8f; max-width:62ch; }
+.billing-v2 .prod-item.avail .prod-price .amt { font-weight:500; color:#cfd0d2; white-space:nowrap; }
+
+/* ---------- Quantity stepper (manage seats/units) ---------- */
+.billing-v2 .qty-row { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:13px 15px;
+ border:1px solid #2b2c30; border-radius:8px; }
+.billing-v2 .qty-info { min-width:0; }
+.billing-v2 .qty-name { font-size:13px; color:#ebebeb; font-weight:500; }
+.billing-v2 .qty-sub { font-size:11.5px; color:#707174; margin-top:2px; }
+.billing-v2 .qty-stepper { display:flex; align-items:center; gap:0; border:1px solid #2b2c30; border-radius:7px; overflow:hidden; flex-shrink:0; }
+.billing-v2 .qty-btn { width:34px; height:34px; display:flex; align-items:center; justify-content:center; background:#16181a;
+ border:none; color:#adaeb0; cursor:pointer; }
+.billing-v2 .qty-btn:hover:not(:disabled) { background:#1f2123; color:#ebebeb; }
+.billing-v2 .qty-btn:disabled { opacity:0.4; cursor:not-allowed; }
+.billing-v2 .qty-val { width:56px; height:34px; display:flex; align-items:center; justify-content:center; font-size:14px;
+ font-weight:600; color:#ebebeb; font-variant-numeric:tabular-nums; border-left:1px solid #2b2c30; border-right:1px solid #2b2c30; }
diff --git a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx
new file mode 100644
index 0000000000..4f393067b2
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx
@@ -0,0 +1,572 @@
+import {
+ BillingV2CatalogProduct,
+ BillingV2Entitlement,
+ BillingV2Invoice,
+ BillingV2Overview
+} from "@app/hooks/api";
+
+import { fmtMoney, intervalWord } from "../billing-v2-data";
+import {
+ IconAlert,
+ IconAlertCircle,
+ IconArrowRight,
+ IconCalendar,
+ IconCreditCard,
+ IconExternal,
+ IconInfo,
+ IconRefresh,
+ IconShoppingBag
+} from "../icons";
+import { Button, Card, Skeleton } from "./primitives";
+import { LimitMeter, ProductIcon, StatusBadge } from "./shared";
+
+export type BillingV2Mode = "self-serve" | "managed";
+export type BillingV2RenderState =
+ | "active"
+ | "trialing"
+ | "past-due"
+ | "suspended"
+ | "no-subscription"
+ | "loading"
+ | "error";
+
+type BannerProps = {
+ mode: BillingV2Mode;
+ subState: BillingV2RenderState;
+ onUpdatePayment: () => void;
+ onManageSubscription: () => void;
+};
+
+// Banners (managed info / dunning).
+const Banner = ({ mode, subState, onUpdatePayment, onManageSubscription }: BannerProps) => {
+ if (mode === "managed") {
+ return (
+ <div className="banner banner-info">
+ <IconInfo className="b-ico" />
+ <div className="b-body">
+ <div className="b-title">Your plan is managed by your account team</div>
+ <div className="b-text">
+ Products and limits on this organization are set by contract. Contact your account
+ manager to make changes.
+ </div>
+ </div>
+ </div>
+ );
+ }
+ if (subState === "past-due") {
+ return (
+ <div className="banner banner-warning">
+ <IconAlert className="b-ico" />
+ <div className="b-body">
+ <div className="b-title">We couldn&apos;t process your last payment</div>
+ <div className="b-text">
+ Update your payment method to avoid losing access. Your products are still active while
+ we retry.
+ </div>
+ <div className="b-actions">
+ <Button variant="warning" size="sm" onClick={onUpdatePayment}>
+ <IconCreditCard size={14} />
+ Update payment method
+ </Button>
+ <Button variant="outline" size="sm" onClick={onManageSubscription}>
+ Manage subscription
+ </Button>
+ </div>
+ </div>
+ </div>
+ );
+ }
+ if (subState === "suspended") {
+ return (
+ <div className="banner banner-danger">
+ <IconAlertCircle className="b-ico" />
+ <div className="b-body">
+ <div className="b-title">Your subscription is suspended</div>
+ <div className="b-text">
+ A payment kept failing and access is paused. Complete payment to restore access to your
+ products.
+ </div>
+ <div className="b-actions">
+ <Button variant="danger" size="sm" onClick={onUpdatePayment}>
+ <IconCreditCard size={14} />
+ Update payment method
+ </Button>
+ <Button variant="outline" size="sm" onClick={onManageSubscription}>
+ Manage subscription
+ </Button>
+ </div>
+ </div>
+ </div>
+ );
+ }
+ return null;
+};
+
+// Loading skeleton.
+const OverviewSkeleton = () => (
+ <div className="stack">
+ <Card noPad>
+ <div style={{ padding: 22, display: "flex", gap: 40 }}>
+ {[0, 1, 2].map((i) => (
+ <div key={i} style={{ flex: 1, display: "flex", flexDirection: "column", gap: 10 }}>
+ <Skeleton w="50%" h={10} />
+ <Skeleton w="70%" h={22} />
+ </div>
+ ))}
+ </div>
+ </Card>
+ <Card title={<Skeleton w={130} h={16} />}>
+ {[0, 1].map((i) => (
+ <div key={i} className="prod-item">
+ <div className="prod-row">
+ <Skeleton w={38} h={38} r={8} />
+ <div className="prod-main" style={{ gap: 8 }}>
+ <Skeleton w="40%" h={14} />
+ <Skeleton w="25%" h={11} />
+ </div>
+ <Skeleton w={80} h={14} />
+ </div>
+ </div>
+ ))}
+ </Card>
+ </div>
+);
+
+type ErrorPanelProps = {
+ onRetry: () => void;
+};
+
+const ErrorPanel = ({ onRetry }: ErrorPanelProps) => (
+ <Card>
+ <div className="err-panel">
+ <IconAlertCircle className="e-ico" size={30} />
+ <div className="e-title">Couldn&apos;t load your subscription</div>
+ <div className="e-text">
+ There was a problem reaching the billing service. Your products are unaffected.
+ </div>
+ <Button variant="outline" size="sm" onClick={onRetry}>
+ <IconRefresh size={14} />
+ Try again
+ </Button>
+ </div>
+ </Card>
+);
+
+type GetStartedProps = {
+ onGetStarted: () => void;
+ loading?: boolean;
+};
+
+const GetStarted = ({ onGetStarted, loading }: GetStartedProps) => (
+ <Card>
+ <div className="getstarted">
+ <div className="gs-ico">
+ <IconShoppingBag size={26} />
+ </div>
+ <div className="gs-title">Start your subscription</div>
+ <div className="gs-text">
+ Pick the products your team needs and check out securely. You can change or cancel any time.
+ </div>
+ <Button variant="org" size="lg" onClick={onGetStarted} loading={loading}>
+ Get started
+ <IconArrowRight size={15} />
+ </Button>
+ </div>
+ </Card>
+);
+
+type SummaryCardProps = {
+ overview: BillingV2Overview;
+};
+
+type StatusBadgeStatus = "trialing" | "past-due" | "suspended" | "active";
+
+const summaryStatus = (subState: BillingV2RenderState): StatusBadgeStatus => {
+ if (subState === "trialing") {
+ return "trialing";
+ }
+ if (subState === "past-due") {
+ return "past-due";
+ }
+ if (subState === "suspended") {
+ return "suspended";
+ }
+ return "active";
+};
+
+const recurringLabel = (overview: BillingV2Overview): string => {
+ if (overview.subState === "no-subscription") {
+ return "No subscription";
+ }
+ if (overview.recurringAmount === null || overview.recurringAmount === 0) {
+ return "Free";
+ }
+ return `${fmtMoney(overview.recurringAmount)} / ${intervalWord(overview.interval)}`;
+};
+
+const SummaryCard = ({ overview }: SummaryCardProps) => (
+ <Card noPad>
+ <div className="summary">
+ <div className="summary-top">
+ <div className="summary-metric">
+ <span className="lbl">Status</span>
+ <span className="val" style={{ display: "flex", alignItems: "center", gap: 9 }}>
+ <StatusBadge status={summaryStatus(overview.subState)} />
+ </span>
+ <span className="sub">{overview.planName}</span>
+ </div>
+ <div className="summary-metric">
+ <span className="lbl">Next billing date</span>
+ <span className="val" style={{ display: "flex", alignItems: "center", gap: 9 }}>
+ <IconCalendar size={19} stroke={1.75} style={{ color: "#30b3ff" }} />
+ {overview.nextBillingDate || "—"}
+ </span>
+ <span className="sub">All products renew together</span>
+ </div>
+ <div className="summary-metric">
+ <span className="lbl">Recurring total</span>
+ <div className="cost-block">
+ <span className="cost-mtd">{recurringLabel(overview)}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </Card>
+);
+
+type UsageCardProps = {
+ overview: BillingV2Overview;
+};
+
+const UsageCard = ({ overview }: UsageCardProps) => (
+ <Card title="Usage">
+ <div className="prod-usage" style={{ marginTop: 0 }}>
+ <LimitMeter
+ label="Members"
+ used={overview.usage.members}
+ limit={overview.usage.memberLimit}
+ />
+ <LimitMeter
+ label="Machine identities"
+ used={overview.usage.identities}
+ limit={overview.usage.identityLimit}
+ />
+ </div>
+ </Card>
+);
+
+type ProductRowProps = {
+ prod: BillingV2CatalogProduct;
+ entitlement?: BillingV2Entitlement;
+ readOnly?: boolean;
+ onManage: (id: string) => void;
+ onContact: (prod: BillingV2CatalogProduct) => void;
+};
+
+const entitlementLabel = (entitlement?: BillingV2Entitlement): string => {
+ if (entitlement?.entitled) {
+ return "Active";
+ }
+ return "Not in your plan";
+};
+
+const ProductRow = ({ prod, entitlement, readOnly, onManage, onContact }: ProductRowProps) => {
+ const entitled = Boolean(entitlement?.entitled);
+ let limitNote: string | null = null;
+ if (entitled && entitlement && entitlement.limit !== null && entitlement.limit !== undefined) {
+ const used = entitlement.used ?? 0;
+ limitNote = `${used.toLocaleString()} / ${entitlement.limit.toLocaleString()}`;
+ }
+
+ const selfServe = Boolean(prod.pro?.planKey);
+
+ let action = null;
+ if (!readOnly) {
+ if (entitled) {
+ action = (
+ <Button variant="outline" size="sm" onClick={() => onManage(prod.id)}>
+ Manage
+ </Button>
+ );
+ } else if (selfServe) {
+ action = (
+ <Button variant="org" size="sm" onClick={() => onManage(prod.id)}>
+ Upgrade
+ </Button>
+ );
+ } else if (prod.enterprise) {
+ action = (
+ <Button variant="info" size="sm" onClick={() => onContact(prod)}>
+ Contact sales
+ </Button>
+ );
+ }
+ }
+
+ return (
+ <div className="prod-item">
+ <div className="prod-row">
+ <ProductIcon product={prod} />
+ <div className="prod-main">
+ <div className="prod-name-row">
+ <span className="prod-name">{prod.name}</span>
+ {prod.addon && <span className="prod-plan-chip">Add-on</span>}
+ {entitled ? (
+ <span className="badge badge-success" style={{ gap: 5 }}>
+ <span className="dot" />
+ {entitlementLabel(entitlement)}
+ </span>
+ ) : (
+ <span className="badge badge-neutral">Not in your plan</span>
+ )}
+ </div>
+ <div className="prod-meta">{prod.tagline || prod.desc}</div>
+ </div>
+ {limitNote && (
+ <div className="prod-price">
+ <span className="amt">{limitNote}</span>
+ <div className="breakdown">in use</div>
+ </div>
+ )}
+ {action && <div className="prod-actions">{action}</div>}
+ </div>
+ </div>
+ );
+};
+
+type ProductsCardProps = {
+ overview: BillingV2Overview;
+ catalog: BillingV2CatalogProduct[];
+ readOnly?: boolean;
+ onManage: (id: string) => void;
+ onContact: (prod: BillingV2CatalogProduct) => void;
+};
+
+const ProductsCard = ({ overview, catalog, readOnly, onManage, onContact }: ProductsCardProps) => (
+ <Card title="Products" desc="Everything you can run on your subscription." noPad>
+ {catalog.length === 0 ? (
+ <div className="empty-row">No products are available yet.</div>
+ ) : (
+ <div className="prod-list" style={{ padding: "4px 20px 16px" }}>
+ {catalog.map((prod) => (
+ <ProductRow
+ key={prod.id}
+ prod={prod}
+ entitlement={overview.entitlements[prod.id]}
+ readOnly={readOnly}
+ onManage={onManage}
+ onContact={onContact}
+ />
+ ))}
+ </div>
+ )}
+ </Card>
+);
+
+type PaymentCardProps = {
+ overview: BillingV2Overview;
+ onUpdate: () => void;
+};
+
+const PaymentCard = ({ overview, onUpdate }: PaymentCardProps) => (
+ <Card
+ title="Payment method"
+ action={
+ <Button variant="outline" size="sm" onClick={onUpdate}>
+ Update
+ </Button>
+ }
+ >
+ {overview.payment ? (
+ <div className="info-row">
+ <div className="info-pair">
+ <div className="card-brand">{overview.payment.brand.toUpperCase()}</div>
+ <div className="info-text">
+ <div className="t1">
+ {overview.payment.brand.toUpperCase()} ending in {overview.payment.last4}
+ </div>
+ <div className="t2">
+ Expires {String(overview.payment.expMonth).padStart(2, "0")} /{" "}
+ {String(overview.payment.expYear).slice(-2)}
+ </div>
+ </div>
+ </div>
+ </div>
+ ) : (
+ <div className="empty-row">No payment method on file yet.</div>
+ )}
+ </Card>
+);
+
+type DetailsCardProps = {
+ overview: BillingV2Overview;
+ onEdit: () => void;
+};
+
+const DetailsCard = ({ overview, onEdit }: DetailsCardProps) => (
+ <Card
+ title="Billing details"
+ action={
+ <Button variant="outline" size="sm" onClick={onEdit}>
+ Edit
+ </Button>
+ }
+ >
+ {overview.billingDetails ? (
+ <div className="detail-grid">
+ <div className="detail-cell">
+ <div className="dk">Billing name</div>
+ <div className="dv">{overview.billingDetails.name || "—"}</div>
+ </div>
+ <div className="detail-cell">
+ <div className="dk">Billing email</div>
+ <div className="dv">{overview.billingDetails.email || "—"}</div>
+ </div>
+ </div>
+ ) : (
+ <div className="empty-row">No billing details on file yet.</div>
+ )}
+ </Card>
+);
+
+type InvoicesCardProps = {
+ invoices: BillingV2Invoice[];
+};
+
+const InvoicesCard = ({ invoices }: InvoicesCardProps) => (
+ <Card title="Invoices">
+ {invoices.length === 0 ? (
+ <div className="empty-row">
+ No invoices yet. Your first invoice appears after your next billing date.
+ </div>
+ ) : (
+ <table className="inv-tbl">
+ <thead>
+ <tr>
+ <th>Date</th>
+ <th>Amount</th>
+ <th>Status</th>
+ <th className="right">Invoice</th>
+ </tr>
+ </thead>
+ <tbody>
+ {invoices.map((inv) => (
+ <tr key={inv.id}>
+ <td>{inv.date}</td>
+ <td className="mono">{fmtMoney(inv.amount)}</td>
+ <td>
+ {inv.paid ? (
+ <span className="badge badge-success">Paid</span>
+ ) : (
+ <span className="badge badge-danger">Unpaid</span>
+ )}
+ </td>
+ <td className="right">
+ {inv.pdfUrl ? (
+ <a className="inv-dl" href={inv.pdfUrl} target="_blank" rel="noopener noreferrer">
+ <IconExternal size={13} />
+ PDF
+ </a>
+ ) : (
+ <span className="dv" style={{ color: "#707174" }}>
+ —
+ </span>
+ )}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ )}
+ </Card>
+);
+
+export type OverviewProps = {
+ overview?: BillingV2Overview;
+ catalog: BillingV2CatalogProduct[];
+ subState: BillingV2RenderState;
+ onManageSubscription: () => void;
+ onUpgrade: (productId: string) => void;
+ onUpdatePayment: () => void;
+ onEditDetails: () => void;
+ onContact: (prod: BillingV2CatalogProduct) => void;
+ onGetStarted: () => void;
+ onRetry: () => void;
+ getStartedLoading?: boolean;
+};
+
+export const Overview = ({
+ overview,
+ catalog,
+ subState,
+ onManageSubscription,
+ onUpgrade,
+ onUpdatePayment,
+ onEditDetails,
+ onContact,
+ onGetStarted,
+ onRetry,
+ getStartedLoading
+}: OverviewProps) => {
+ if (subState === "loading") {
+ return <OverviewSkeleton />;
+ }
+
+ if (subState === "error" || !overview) {
+ return (
+ <div className="stack">
+ <ErrorPanel onRetry={onRetry} />
+ </div>
+ );
+ }
+
+ const { mode } = overview;
+ const isManaged = mode === "managed";
+
+ if (subState === "no-subscription") {
+ return (
+ <div className="stack">
+ <Banner
+ mode={mode}
+ subState={subState}
+ onUpdatePayment={onUpdatePayment}
+ onManageSubscription={onManageSubscription}
+ />
+ <GetStarted onGetStarted={onGetStarted} loading={getStartedLoading} />
+ <UsageCard overview={overview} />
+ <ProductsCard
+ overview={overview}
+ catalog={catalog}
+ readOnly={isManaged}
+ onManage={onUpgrade}
+ onContact={onContact}
+ />
+ </div>
+ );
+ }
+
+ const showPayment = overview.isCloud && !isManaged;
+
+ return (
+ <div className="stack">
+ <Banner
+ mode={mode}
+ subState={subState}
+ onUpdatePayment={onUpdatePayment}
+ onManageSubscription={onManageSubscription}
+ />
+ <SummaryCard overview={overview} />
+ <UsageCard overview={overview} />
+ <ProductsCard
+ overview={overview}
+ catalog={catalog}
+ readOnly={isManaged}
+ onManage={onUpgrade}
+ onContact={onContact}
+ />
+ {showPayment && <PaymentCard overview={overview} onUpdate={onUpdatePayment} />}
+ {!isManaged && <DetailsCard overview={overview} onEdit={onEditDetails} />}
+ {showPayment && <InvoicesCard invoices={overview.invoices} />}
+ </div>
+ );
+};
diff --git a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx
new file mode 100644
index 0000000000..8921f16300
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx
@@ -0,0 +1,292 @@
+import { BillingV2Cadence, BillingV2CatalogProduct, BillingV2Entitlement } from "@app/hooks/api";
+
+import { cadenceWord, fmtMoney, fmtMoney2, unitPrice } from "../billing-v2-data";
+import { IconArrowRight, IconCheck, IconExternal, IconPlus, IconX } from "../icons";
+import { Button } from "./primitives";
+import { ProductIcon } from "./shared";
+
+type ProPriceParts = { amt: string; unit: string } | null;
+
+const proPriceParts = (prod: BillingV2CatalogProduct, cad: BillingV2Cadence): ProPriceParts => {
+ if (prod.model === "flat" || prod.model === "limit") {
+ const b = prod.pro?.base;
+ if (!b) {
+ return null;
+ }
+ return { amt: fmtMoney(unitPrice(b, cad)), unit: `/ ${cadenceWord(cad)}` };
+ }
+
+ const d = prod.pro?.dims?.[0];
+ if (!d) {
+ return null;
+ }
+ let suffix = "mo";
+ if (cad === "annual") {
+ suffix = "yr";
+ }
+ return { amt: fmtMoney2(unitPrice(d, cad)), unit: `/ ${d.noun} / ${suffix}` };
+};
+
+export const CmpCell = (v: string | boolean) => {
+ if (v === true) {
+ return (
+ <span className="cmp-check">
+ <IconCheck size={15} stroke={2.5} />
+ </span>
+ );
+ }
+ if (v === false) {
+ return <span className="cmp-dash">—</span>;
+ }
+ return v;
+};
+
+type EntitlementSummaryProps = {
+ entitlement?: BillingV2Entitlement;
+};
+
+const EntitlementSummary = ({ entitlement }: EntitlementSummaryProps) => {
+ const entitled = Boolean(entitlement?.entitled);
+ let detail = "This product is not part of your current plan.";
+ if (entitled) {
+ detail = "This product is active on your subscription.";
+ if (entitlement && entitlement.limit !== null && entitlement.limit !== undefined) {
+ const used = entitlement.used ?? 0;
+ detail = `Active on your subscription. ${used.toLocaleString()} of ${entitlement.limit.toLocaleString()} in use.`;
+ }
+ }
+ return (
+ <div className="sheet-usage">
+ <div className="su-top">
+ <span className="su-lbl">Your plan</span>
+ {entitled ? (
+ <span className="badge badge-success" style={{ gap: 5 }}>
+ <span className="dot" />
+ Active
+ </span>
+ ) : (
+ <span className="badge badge-neutral">Not in your plan</span>
+ )}
+ </div>
+ <div className="tier-desc" style={{ flex: "none" }}>
+ {detail}
+ </div>
+ </div>
+ );
+};
+
+type PlansViewProps = {
+ prod: BillingV2CatalogProduct;
+ entitlement?: BillingV2Entitlement;
+ cadence: BillingV2Cadence;
+};
+
+const PlansView = ({ prod, entitlement, cadence }: PlansViewProps) => {
+ const hasEnt = !!prod.enterprise;
+ const pp = proPriceParts(prod, cadence);
+ const entitled = Boolean(entitlement?.entitled);
+
+ return (
+ <>
+ <EntitlementSummary entitlement={entitlement} />
+
+ <div className={`tier-cards ${hasEnt ? "" : "single"}`}>
+ <div className={`tier-card ${entitled ? "current" : "featured"}`}>
+ <div className="tier-top">
+ <span className="tier-name">Pro</span>
+ {entitled ? (
+ <span className="badge badge-outline" style={{ gap: 5 }}>
+ <IconCheck size={11} stroke={2.5} style={{ color: "#2ecc71" }} />
+ Current plan
+ </span>
+ ) : (
+ <span className="badge badge-org">Self-serve</span>
+ )}
+ </div>
+ {pp ? (
+ <div className="tier-price">
+ <span className="tp-amt">{pp.amt}</span>
+ <span className="tp-unit">{pp.unit}</span>
+ </div>
+ ) : null}
+ {prod.pro?.proFeature ? <div className="tier-desc">{prod.pro.proFeature}</div> : null}
+ </div>
+
+ {hasEnt && prod.enterprise ? (
+ <div className="tier-card">
+ <div className="tier-top">
+ <span className="tier-name">Enterprise</span>
+ <span className="badge badge-info">Sales-led</span>
+ </div>
+ <div className="tier-price">
+ <span className="tp-amt">Custom</span>
+ </div>
+ <div className="tier-desc">{prod.enterprise.feature}</div>
+ </div>
+ ) : null}
+ </div>
+
+ {hasEnt && prod.compare ? (
+ <div>
+ <div className="cmp-h">Compare plans</div>
+ <div className="cmp-wrap">
+ <table className="cmp-table">
+ <thead>
+ <tr>
+ <th aria-label="Feature" />
+ <th className="col">
+ <span className="ch-name org">Pro</span>
+ </th>
+ <th className="col ent">
+ <span className="ch-name ent">Enterprise</span>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {prod.compare.map((row) => (
+ <tr key={row.label}>
+ <td className="feat">{row.label}</td>
+ <td className="col">{CmpCell(row.pro)}</td>
+ <td className="col ent">{CmpCell(row.ent)}</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ ) : null}
+
+ {!(hasEnt && prod.compare) && prod.includes ? (
+ <div>
+ <div className="cmp-h">What&apos;s included</div>
+ <div className="incl-list">
+ {prod.includes.map((f) => (
+ <div className="incl-item" key={f}>
+ <IconCheck className="ci-ico" size={14} stroke={2.25} />
+ {f}
+ </div>
+ ))}
+ </div>
+ </div>
+ ) : null}
+ </>
+ );
+};
+
+type ProductSheetProps = {
+ prodId: string;
+ prod?: BillingV2CatalogProduct;
+ entitlement?: BillingV2Entitlement;
+ cadence: BillingV2Cadence;
+ redirecting?: boolean;
+ onClose: () => void;
+ onManage: (prodId: string) => void;
+ onContact: (prod: BillingV2CatalogProduct) => void;
+};
+
+export const ProductSheet = ({
+ prodId,
+ prod,
+ entitlement,
+ cadence,
+ redirecting,
+ onClose,
+ onManage,
+ onContact
+}: ProductSheetProps) => {
+ if (!prod) {
+ return null;
+ }
+
+ const entitled = Boolean(entitlement?.entitled);
+ const selfServe = Boolean(prod.pro?.planKey);
+
+ let primaryCta = null;
+ if (entitled) {
+ primaryCta = (
+ <Button variant="org" onClick={() => onManage(prodId)} loading={redirecting}>
+ Manage in Stripe
+ <IconExternal size={14} />
+ </Button>
+ );
+ } else if (selfServe) {
+ primaryCta = (
+ <Button variant="org" onClick={() => onManage(prodId)} loading={redirecting}>
+ <IconPlus size={14} />
+ Activate in Stripe
+ </Button>
+ );
+ } else if (prod.enterprise) {
+ primaryCta = (
+ <Button variant="info" onClick={() => onContact(prod)}>
+ Contact sales
+ <IconArrowRight size={14} />
+ </Button>
+ );
+ }
+
+ // A product with both a self-serve tier and an Enterprise tier keeps a sales path alongside checkout.
+ let secondaryCta = null;
+ if (!entitled && selfServe && prod.enterprise) {
+ secondaryCta = (
+ <Button variant="info" onClick={() => onContact(prod)} disabled={redirecting}>
+ Contact sales
+ <IconArrowRight size={14} />
+ </Button>
+ );
+ }
+
+ return (
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
+ <div
+ className="sheet-backdrop"
+ onMouseDown={(e) => {
+ if (e.target === e.currentTarget && !redirecting) {
+ onClose();
+ }
+ }}
+ >
+ <div className="sheet" role="dialog" aria-modal="true">
+ <div className="sheet-head">
+ <ProductIcon product={prod} size={40} />
+ <div className="sh-titles">
+ <div className="sheet-title">
+ {prod.name}
+ {entitled ? (
+ <span className="badge badge-success" style={{ gap: 5 }}>
+ <span className="dot" />
+ Active
+ </span>
+ ) : null}
+ {prod.addon ? <span className="badge badge-neutral">Add-on</span> : null}
+ </div>
+ <div className="sheet-sub">{prod.tagline || prod.desc}</div>
+ </div>
+ {!redirecting ? (
+ <button
+ type="button"
+ className="icon-btn"
+ onClick={onClose}
+ aria-label="Close"
+ style={{ marginTop: -2, marginRight: -6 }}
+ >
+ <IconX size={17} />
+ </button>
+ ) : null}
+ </div>
+
+ <div className="sheet-body">
+ <PlansView prod={prod} entitlement={entitlement} cadence={cadence} />
+ </div>
+
+ <div className="sheet-foot">
+ <Button variant="outline" onClick={onClose} disabled={redirecting}>
+ Close
+ </Button>
+ {secondaryCta}
+ {primaryCta}
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/organization/BillingV2Page/components/primitives.tsx b/frontend/src/pages/organization/BillingV2Page/components/primitives.tsx
new file mode 100644
index 0000000000..0aa8c4e2e1
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/components/primitives.tsx
@@ -0,0 +1,217 @@
+import {
+ ButtonHTMLAttributes,
+ CSSProperties,
+ InputHTMLAttributes,
+ MouseEvent,
+ ReactNode
+} from "react";
+
+import { IconExternal, IconX } from "../icons";
+
+export type ButtonVariant =
+ | "outline"
+ | "ghost"
+ | "neutral"
+ | "org"
+ | "success"
+ | "info"
+ | "warning"
+ | "danger";
+export type ButtonSize = "xs" | "sm" | "md" | "lg";
+
+type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
+ variant?: ButtonVariant;
+ size?: ButtonSize;
+ full?: boolean;
+ loading?: boolean;
+};
+
+export const Button = ({
+ variant = "outline",
+ size = "md",
+ children,
+ full,
+ loading,
+ disabled,
+ ...rest
+}: ButtonProps) => (
+ <button
+ type="button"
+ className={`btn btn-${variant} ${size} ${full ? "full" : ""}`}
+ disabled={loading || disabled}
+ {...rest}
+ >
+ {loading && <span className="spin" style={{ width: 13, height: 13 }} />}
+ {children}
+ </button>
+);
+
+type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
+ title?: string;
+};
+
+export const IconButton = ({ children, title, ...rest }: IconButtonProps) => (
+ <button type="button" className="icon-btn" title={title} {...rest}>
+ {children}
+ </button>
+);
+
+export type BadgeVariant =
+ | "neutral"
+ | "success"
+ | "info"
+ | "warning"
+ | "danger"
+ | "org"
+ | "outline";
+
+type BadgeProps = {
+ variant?: BadgeVariant;
+ dot?: boolean;
+ children?: ReactNode;
+};
+
+export const Badge = ({ variant = "neutral", dot, children }: BadgeProps) => (
+ <span className={`badge badge-${variant}`}>
+ {dot && <span className="dot" />}
+ {children}
+ </span>
+);
+
+type InputProps = InputHTMLAttributes<HTMLInputElement>;
+
+export const Input = (p: InputProps) => <input className="input" {...p} />;
+
+type FieldProps = {
+ label?: ReactNode;
+ desc?: ReactNode;
+ children?: ReactNode;
+};
+
+export const Field = ({ label, desc, children }: FieldProps) => (
+ <div>
+ {label && (
+ // eslint-disable-next-line jsx-a11y/label-has-associated-control
+ <label className="field-label">{label}</label>
+ )}
+ {children}
+ {desc && <div className="field-desc">{desc}</div>}
+ </div>
+);
+
+type CardProps = {
+ title?: ReactNode;
+ desc?: ReactNode;
+ action?: ReactNode;
+ docs?: boolean;
+ noPad?: boolean;
+ children?: ReactNode;
+ style?: CSSProperties;
+};
+
+export const Card = ({ title, desc, action, docs, noPad, children, style }: CardProps) => {
+ let headerStyle: CSSProperties | undefined;
+ if (noPad) {
+ headerStyle = { padding: "18px 20px 0" };
+ }
+ return (
+ <div className={`card ${noPad ? "no-pad" : ""}`} style={style}>
+ {(title || action) && (
+ <div className="card-header" style={headerStyle}>
+ <div>
+ <div className="card-title">
+ {title}
+ {docs && (
+ <a className="badge badge-info" style={{ cursor: "pointer" }}>
+ Documentation <IconExternal size={11} stroke={2.25} />
+ </a>
+ )}
+ </div>
+ {desc && <div className="card-desc">{desc}</div>}
+ </div>
+ {action && (
+ <div style={{ display: "flex", gap: 8, alignItems: "center", flexShrink: 0 }}>
+ {action}
+ </div>
+ )}
+ </div>
+ )}
+ {children}
+ </div>
+ );
+};
+
+type SkeletonProps = {
+ w?: number | string;
+ h?: number | string;
+ r?: number | string;
+ style?: CSSProperties;
+};
+
+export const Skeleton = ({ w = "100%", h = 14, r, style }: SkeletonProps) => (
+ <div className="sk" style={{ width: w, height: h, borderRadius: r, ...style }} />
+);
+
+type ModalProps = {
+ title?: ReactNode;
+ desc?: ReactNode;
+ onClose?: () => void;
+ wide?: boolean;
+ children?: ReactNode;
+ footer?: ReactNode;
+ closable?: boolean;
+};
+
+// Modal — centered dialog. onClose fires on backdrop click + close button.
+export const Modal = ({
+ title,
+ desc,
+ onClose,
+ wide,
+ children,
+ footer,
+ closable = true
+}: ModalProps) => {
+ const onBackdropMouseDown = (e: MouseEvent<HTMLDivElement>) => {
+ if (e.target === e.currentTarget && closable) {
+ onClose?.();
+ }
+ };
+ return (
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
+ <div className="modal-backdrop" onMouseDown={onBackdropMouseDown}>
+ <div className={`modal ${wide ? "wide" : ""}`} role="dialog" aria-modal="true">
+ {(title || closable) && (
+ <div className="modal-head">
+ <div>
+ {title && <div className="m-title">{title}</div>}
+ {desc && <div className="m-desc">{desc}</div>}
+ </div>
+ {closable && (
+ <button
+ type="button"
+ className="icon-btn"
+ onClick={onClose}
+ aria-label="Close"
+ style={{ marginTop: -2, marginRight: -6 }}
+ >
+ <IconX size={16} />
+ </button>
+ )}
+ </div>
+ )}
+ <div className="modal-body">{children}</div>
+ {footer && <div className="modal-foot">{footer}</div>}
+ </div>
+ </div>
+ );
+};
+
+type SpinnerProps = {
+ lg?: boolean;
+ org?: boolean;
+};
+
+export const Spinner = ({ lg, org }: SpinnerProps) => (
+ <span className={`spin ${lg ? "lg" : ""} ${org ? "org" : ""}`} />
+);
diff --git a/frontend/src/pages/organization/BillingV2Page/components/shared.tsx b/frontend/src/pages/organization/BillingV2Page/components/shared.tsx
new file mode 100644
index 0000000000..2f39bdec5d
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/components/shared.tsx
@@ -0,0 +1,123 @@
+import { BillingV2CatalogProduct } from "@app/hooks/api";
+
+import {
+ IconBox,
+ IconKey,
+ IconLock,
+ IconProps,
+ IconScan,
+ IconShieldCheck,
+ IconZap
+} from "../icons";
+
+type IconComponent = (props: IconProps) => JSX.Element;
+
+const ICON_BY_NAME: Record<string, IconComponent> = {
+ IconKey,
+ IconShieldCheck,
+ IconLock,
+ IconScan,
+ IconZap,
+ IconBox
+};
+
+type StatusType = "trialing" | "past-due" | "suspended" | "active";
+
+type MeterTone = "ok" | "near" | "full";
+
+type ProductIconProps = {
+ product: BillingV2CatalogProduct;
+ size?: number;
+};
+
+// Tinted product icon tile (follows the design-system tint pattern).
+export const ProductIcon = ({ product, size = 38 }: ProductIconProps) => {
+ const Glyph = ICON_BY_NAME[product.icon] || IconBox;
+ const c = product.color;
+ return (
+ <div
+ className="prod-ico"
+ style={{
+ width: size,
+ height: size,
+ background: `color-mix(in srgb, ${c} 14%, transparent)`,
+ borderColor: `color-mix(in srgb, ${c} 30%, transparent)`,
+ color: c
+ }}
+ >
+ <Glyph size={Math.round(size * 0.5)} stroke={1.75} />
+ </div>
+ );
+};
+
+type StatusBadgeProps = {
+ status: StatusType;
+};
+
+export const StatusBadge = ({ status }: StatusBadgeProps) => {
+ if (status === "trialing") {
+ return <span className="badge badge-info">Trial</span>;
+ }
+ if (status === "past-due") {
+ return <span className="badge badge-warning">Past due</span>;
+ }
+ if (status === "suspended") {
+ return <span className="badge badge-danger">Suspended</span>;
+ }
+ return (
+ <span className="badge badge-success" style={{ gap: 5 }}>
+ <span className="dot" />
+ Active
+ </span>
+ );
+};
+
+// Usage level to meter color. A null limit is unlimited (no bar, no alarm).
+export const meterTone = (used: number, limit: number | null): MeterTone => {
+ if (!limit || limit <= 2) {
+ return "ok";
+ }
+ const r = used / limit;
+ if (r >= 1) {
+ return "full";
+ }
+ if (r >= 0.85) {
+ return "near";
+ }
+ return "ok";
+};
+
+type LimitMeterProps = {
+ label: string;
+ used: number;
+ limit: number | null;
+};
+
+// A single real usage meter: label, used/limit bar. Null limit renders "Unlimited" with no bar.
+export const LimitMeter = ({ label, used, limit }: LimitMeterProps) => {
+ const tone = meterTone(used, limit);
+ let pct = 0;
+ if (limit) {
+ pct = Math.min(100, Math.round((used / limit) * 100));
+ }
+ return (
+ <div className="meter">
+ <div className="meter-top">
+ <span className="meter-label">{label}</span>
+ <span className={`meter-count tone-${tone}`}>
+ {used.toLocaleString()}
+ {limit === null ? (
+ <span className="meter-cap"> / Unlimited</span>
+ ) : (
+ <span className="meter-cap"> / {limit.toLocaleString()}</span>
+ )}
+ </span>
+ </div>
+ {limit !== null && limit > 0 && (
+ <div className="meter-track">
+ <div className={`meter-fill tone-${tone}`} style={{ width: `${pct}%` }} />
+ </div>
+ )}
+ </div>
+ );
+};
diff --git a/frontend/src/pages/organization/BillingV2Page/icons.tsx b/frontend/src/pages/organization/BillingV2Page/icons.tsx
new file mode 100644
index 0000000000..4447103f2f
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/icons.tsx
@@ -0,0 +1,531 @@
+import { CSSProperties, ReactNode } from "react";
+
+export type IconProps = {
+ size?: number;
+ stroke?: number;
+ fill?: string;
+ className?: string;
+ style?: CSSProperties;
+};
+
+type IconBaseProps = IconProps & { d: ReactNode };
+
+const Icon = ({
+ d,
+ size = 16,
+ stroke = 1.75,
+ fill = "none",
+ className = "ico",
+ style
+}: IconBaseProps) => (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill={fill}
+ stroke="currentColor"
+ strokeWidth={stroke}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className={className}
+ style={style}
+ >
+ {d}
+ </svg>
+);
+
+export const IconKey = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <circle cx="7.5" cy="15.5" r="5.5" />
+ <path d="m21 2-9.6 9.6" />
+ <path d="m15.5 7.5 3 3L22 7l-3-3" />
+ </>
+ }
+ />
+);
+
+export const IconShieldCheck = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" />
+ <path d="m9 12 2 2 4-4" />
+ </>
+ }
+ />
+);
+
+export const IconLock = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <rect x="3" y="11" width="18" height="11" rx="2" />
+ <path d="M7 11V7a5 5 0 0 1 10 0v4" />
+ </>
+ }
+ />
+);
+
+export const IconScan = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M3 7V5a2 2 0 0 1 2-2h2" />
+ <path d="M17 3h2a2 2 0 0 1 2 2v2" />
+ <path d="M21 17v2a2 2 0 0 1-2 2h-2" />
+ <path d="M7 21H5a2 2 0 0 1-2-2v-2" />
+ <path d="M7 12h10" />
+ </>
+ }
+ />
+);
+
+export const IconZap = (p: IconProps) => (
+ <Icon {...p} d={<path d="M13 2 3 14h9l-1 8 10-12h-9z" />} />
+);
+
+export const IconPlus = (p: IconProps) => <Icon {...p} d={<path d="M12 5v14M5 12h14" />} />;
+
+export const IconCheck = (p: IconProps) => <Icon {...p} d={<path d="M20 6 9 17l-5-5" />} />;
+
+export const IconX = (p: IconProps) => <Icon {...p} d={<path d="M18 6 6 18M6 6l12 12" />} />;
+
+export const IconTrash = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M3 6h18" />
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" />
+ <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
+ </>
+ }
+ />
+);
+
+export const IconExternal = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6" />
+ <path d="m14 4 6 6" />
+ <path d="M21 3h-7v7" />
+ </>
+ }
+ />
+);
+
+export const IconDownload = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
+ <path d="M7 10l5 5 5-5" />
+ <path d="M12 15V3" />
+ </>
+ }
+ />
+);
+
+export const IconAlert = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
+ <line x1="12" y1="9" x2="12" y2="13" />
+ <line x1="12" y1="17" x2="12.01" y2="17" />
+ </>
+ }
+ />
+);
+
+export const IconAlertCircle = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <circle cx="12" cy="12" r="10" />
+ <line x1="12" y1="8" x2="12" y2="12" />
+ <line x1="12" y1="16" x2="12.01" y2="16" />
+ </>
+ }
+ />
+);
+
+export const IconInfo = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <circle cx="12" cy="12" r="10" />
+ <path d="M12 16v-4" />
+ <path d="M12 8h.01" />
+ </>
+ }
+ />
+);
+
+export const IconCalendar = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <rect x="3" y="4" width="18" height="18" rx="2" />
+ <path d="M16 2v4M8 2v4M3 10h18" />
+ </>
+ }
+ />
+);
+
+export const IconCreditCard = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <rect x="2" y="5" width="20" height="14" rx="2" />
+ <line x1="2" y1="10" x2="22" y2="10" />
+ </>
+ }
+ />
+);
+
+export const IconReceipt = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1-2-1z" />
+ <path d="M8 7h8M8 11h8M8 15h5" />
+ </>
+ }
+ />
+);
+
+export const IconBuilding = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <rect x="4" y="2" width="16" height="20" rx="2" />
+ <path d="M9 22v-4h6v4" />
+ <path d="M8 6h.01M16 6h.01M8 10h.01M16 10h.01M8 14h.01M16 14h.01" />
+ </>
+ }
+ />
+);
+
+export const IconShoppingBag = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z" />
+ <path d="M3 6h18" />
+ <path d="M16 10a4 4 0 0 1-8 0" />
+ </>
+ }
+ />
+);
+
+export const IconLayers = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="m12 2 9 5-9 5-9-5 9-5z" />
+ <path d="m3 12 9 5 9-5" />
+ <path d="m3 17 9 5 9-5" />
+ </>
+ }
+ />
+);
+
+export const IconChevronRight = (p: IconProps) => (
+ <Icon stroke={2} {...p} d={<path d="m9 18 6-6-6-6" />} />
+);
+
+export const IconChevronLeft = (p: IconProps) => (
+ <Icon stroke={2} {...p} d={<path d="m15 18-6-6 6-6" />} />
+);
+
+export const IconChevronDown = (p: IconProps) => (
+ <Icon stroke={2} {...p} d={<path d="m6 9 6 6 6-6" />} />
+);
+
+export const IconArrowRight = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M5 12h14" />
+ <path d="m12 5 7 7-7 7" />
+ </>
+ }
+ />
+);
+
+export const IconArrowUp = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M12 19V5" />
+ <path d="m5 12 7-7 7 7" />
+ </>
+ }
+ />
+);
+
+export const IconMinus = (p: IconProps) => <Icon {...p} d={<path d="M5 12h14" />} />;
+
+export const IconRefresh = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
+ <path d="M21 3v5h-5" />
+ <path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
+ <path d="M3 21v-5h5" />
+ </>
+ }
+ />
+);
+
+export const IconLink = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
+ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
+ </>
+ }
+ />
+);
+
+export const IconBuilding2 = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" />
+ <path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" />
+ <path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" />
+ <path d="M10 6h4M10 10h4M10 14h4M10 18h4" />
+ </>
+ }
+ />
+);
+
+export const IconChevronsUpDown = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="m7 15 5 5 5-5" />
+ <path d="m7 9 5-5 5 5" />
+ </>
+ }
+ />
+);
+
+export const IconServer = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <rect width="20" height="8" x="2" y="2" rx="2" />
+ <rect width="20" height="8" x="2" y="14" rx="2" />
+ <line x1="6" x2="6.01" y1="6" y2="6" />
+ <line x1="6" x2="6.01" y1="18" y2="18" />
+ </>
+ }
+ />
+);
+
+export const IconHelp = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <circle cx="12" cy="12" r="10" />
+ <path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
+ <path d="M12 17h.01" />
+ </>
+ }
+ />
+);
+
+export const IconBell = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M10.27 21a2 2 0 0 0 3.46 0" />
+ <path d="M13.92 2.31A6 6 0 0 0 6 8c0 4.5-1.41 5.96-2.74 7.33A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.67 9 9 0 0 1-.59-.66" />
+ <circle cx="18" cy="8" r="3" />
+ </>
+ }
+ />
+);
+
+export const IconUser = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" />
+ <circle cx="12" cy="7" r="4" />
+ </>
+ }
+ />
+);
+
+export const IconPanelLeft = (p: IconProps) => (
+ <Icon
+ stroke={1.5}
+ {...p}
+ d={
+ <>
+ <rect width="18" height="18" x="3" y="3" rx="2" />
+ <path d="M9 3v18" />
+ </>
+ }
+ />
+);
+
+export const IconSettings = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <circle cx="12" cy="12" r="3" />
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h0a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h0a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v0a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
+ </>
+ }
+ />
+);
+
+export const IconShield = (p: IconProps) => (
+ <Icon {...p} d={<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />} />
+);
+
+export const IconActivity = (p: IconProps) => (
+ <Icon {...p} d={<polyline points="22 12 18 12 15 21 9 3 6 12 2 12" />} />
+);
+
+export const IconFileText = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" />
+ <path d="M14 2v4a2 2 0 0 0 2 2h4" />
+ <path d="M16 13H8M16 17H8M10 9H8" />
+ </>
+ }
+ />
+);
+
+export const IconBox = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />
+ <polyline points="3.27 6.96 12 12.01 20.73 6.96" />
+ <line x1="12" y1="22.08" x2="12" y2="12" />
+ </>
+ }
+ />
+);
+
+export const IconUsers = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
+ <circle cx="9" cy="7" r="4" />
+ <path d="M22 21v-2a4 4 0 0 0-3-3.87" />
+ <path d="M16 3.13a4 4 0 0 1 0 7.75" />
+ </>
+ }
+ />
+);
+
+export const IconPlug = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M12 22v-5" />
+ <path d="M9 8V2M15 8V2" />
+ <path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z" />
+ </>
+ }
+ />
+);
+
+export const IconBookCheck = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" />
+ <path d="m9 9.5 2 2 4-4" />
+ </>
+ }
+ />
+);
+
+export const IconWallet = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <path d="M19 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0 0 4h14a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5" />
+ <path d="M16 12h.01" />
+ </>
+ }
+ />
+);
+
+export const IconLifeBuoy = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <circle cx="12" cy="12" r="10" />
+ <circle cx="12" cy="12" r="4" />
+ <line x1="4.93" y1="4.93" x2="9.17" y2="9.17" />
+ <line x1="14.83" y1="14.83" x2="19.07" y2="19.07" />
+ <line x1="14.83" y1="9.17" x2="19.07" y2="4.93" />
+ <line x1="4.93" y1="19.07" x2="9.17" y2="14.83" />
+ </>
+ }
+ />
+);
+
+export const IconPauseCircle = (p: IconProps) => (
+ <Icon
+ {...p}
+ d={
+ <>
+ <circle cx="12" cy="12" r="10" />
+ <line x1="10" y1="15" x2="10" y2="9" />
+ <line x1="14" y1="15" x2="14" y2="9" />
+ </>
+ }
+ />
+);
diff --git a/frontend/src/pages/organization/BillingV2Page/index.tsx b/frontend/src/pages/organization/BillingV2Page/index.tsx
new file mode 100644
index 0000000000..b342ac39b4
--- /dev/null
+++ b/frontend/src/pages/organization/BillingV2Page/index.tsx
@@ -0,0 +1 @@
+export { BillingV2Page } from "./BillingV2Page";