Skip to main content
WorkspaceSubscription is the billing anchor for a Well workspace. It stores the Stripe customer identity and the active Stripe pricing-plan subscription reference alongside a mirrored subscription status that is kept in sync by the Stripe webhook pipeline. Each workspace owns exactly one subscription row, created during the workspace-creation flow and updated automatically as Stripe events arrive. It is the record the billing middleware consults to gate premium features and the record the Stripe webhook handler writes to when a subscription transitions state.
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

Data model

Attributes

Relationships

System-computed

  • workspace_subscription_id β€” generated by gen_random_uuid() at the database level on INSERT; also seeded client-side via randomUUID() as the ORM default
  • created_at β€” set by MikroORM onCreate lifecycle hook to new Date(); never user-supplied
  • updated_at β€” set by MikroORM onCreate and onUpdate lifecycle hooks; reflects every Stripe-webhook-driven mutation
  • deleted_at β€” not set by any automated pipeline today; available as the soft-delete sentinel column following the platform convention
  • status β€” written exclusively by the Stripe webhook handler (stripe-webhooks.service.ts) and by SubscriptionsService.syncSubscriptionFromStripe; mirrors Stripe pricing-plan servicing_status (active / canceled / paused)
  • stripe_customer_id β€” written by SubscriptionsService when creating or linking a Stripe Customer for the workspace
  • stripe_pricing_plan_subscription_id β€” written by SubscriptionsService when a pricing-plan subscription is activated or changed

Example

Source: apps/api/src/database/entities/WorkspaceSubscription.ts Β· domain: workspace Β· tier: Platform