feat(billing): bill workspaces under a parent workspace#1320
Draft
vklimontovich wants to merge 1 commit into
Draft
feat(billing): bill workspaces under a parent workspace#1320vklimontovich wants to merge 1 commit into
vklimontovich wants to merge 1 commit into
Conversation
A workspace can now bill under a parent. The child inherits the parent's plan and its billing page links to the parent; the parent's billing page sums events and syncs across the whole group. The parent-child relation and consolidation logic live in ee-api (newjitsuee schema). Links are managed from a new admin UI page. Only one level of nesting is allowed and free workspaces cannot be joined.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A workspace can now bill under a parent workspace. The child inherits the parent's
plan, and the parent's billing page consolidates usage for the whole group.
/settings/billingshows a card linking to the parent's billingpage instead of its own billing UI. The child inherits the parent's plan (limits,
feature gating,
pastDue), and no Stripe customer is created for it./settings/billingsums events and active syncs across theparent and all its children (summed totals only, no per-child breakdown).
How
newjitsueeschema) in a newWorkspaceBillingParenttable, with all hierarchy/consolidation logic inlib/billing-hierarchy.ts.getOrCreateCurrentSubscriptionreturns the parent's subscription for a child,tagged with a
billingParentmarker./api/billing/settingsendpoint via anopt-in
?withUsage=trueflag — no new endpoints. The app-wideBillingProviderfetch stays light; only the billing page requests usage.
(
/billing-parents), backed by/api/admin/billing-parents.free workspaces cannot be joined.
Notes / follow-ups
prisma db pushon thenewjitsueeschema to createworkspace_billing_parent.scope — grouped workspaces are paid, so the only enforcement that matters
(
pastDue) is inherited by children automatically./settings/billing/details) still shows asingle workspace, not the consolidated group.
billing-hierarchyvalidation is not unit-tested.Verification
pnpm codegen, thenpnpm --filter ee-api db:update-schemato create the table.pnpm ui:dev; in the ee-api admin Billing Parents page, link a paid child undera paid parent.
/settings/billingshows the link card; parent/settings/billingshowssummed usage. Self-link / two-level nesting / free-plan child are rejected.