Skip to main content

Documentation

Data Model

Stackhouse-Billing tables and how they relate to each other.

Data Model

All Stackhouse-Billing tables are prefixed billing_ and created by idempotent migrations that run on boot when the module is enabled.

Entity relationships

Rendering diagram…

Tables

TablePurpose
appsTop-level tenant boundary — one row per app using Stackhouse-Billing
productsStore-side SKUs (store, store_product_id, product_type)
entitlementsNamed feature/access grants (e.g. pro)
entitlement_productsMany-to-many join: which products unlock which entitlements
offeringsNamed groups of packages shown in a paywall (one marked is_current per app)
packagesPurchasable options within an offering, each referencing a product
audiencesRule groups used by offerings and experiments
experimentsA/B tests with status, audience, and metric
experiment_variantsWeighted offering pointers belonging to an experiment
experiment_assignmentsSticky (experiment, customer) → variant mapping
experiment_eventsImpressions and conversions per variant
paywallsPer-offering live/draft visual configuration
customersEnd users, identified by app_user_id
subscriptionsActive/expired subscription state per customer + product
transactionsIndividual purchase/renewal/refund events
receiptsRaw receipt payloads submitted by clients, for audit/replay
webhook_endpointsOutbound listener URLs registered by app owners
webhook_deliveriesDelivery attempts, status, and retry state

See src/billing/schema.rs for the full DDL.