Billing and Entitlements
Audience: admin and internal operators.
Model
Billing is organization-level. Workspace entitlements are derived from:
- Plan template
- Stripe synchronization layer
- Ops overrides
- Effective merged entitlements
Enforcement boundaries
Entitlements are enforced on high-risk operations, including:
- Production/sandbox controlled-action usage limits
- Member/workspace limits
- Active policy/action-type caps
Stripe integration
- Price resolution uses stable lookup keys
- Metered overage reports send deltas only (idempotent usage reporting)
- Webhooks update subscription and billing state
Internal operations
Internal entitlement and enterprise-assignment endpoints are exposed under /internal/* and require INTERNAL_SERVICE_TOKEN.
Implementation references
- Plan templates:
packages/shared/src/billing/planEntitlementTemplates.ts - Quantity formulas:
apps/api/src/billing/billingQuantity.ts - Entitlement service:
apps/api/src/services/entitlementService.ts