> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# StateSet Billing

> The self-service billing portal — outcome-based plans, à la carte modules, outcome SKUs, and shared entitlements across StateSet products.

# StateSet Billing

The self-service billing portal, hosted at **billing.stateset.com**. Customers sign in with
their StateSet (WorkOS) account to manage plans, modules, payment methods, and invoices.

## What customers can do

* Pick a platform **plan** — Starter, Growth, or Enterprise, on outcome-based pricing.
* Activate **modules** à la carte: Voice, Chat Widget, Email, and Computer Use.
* Track **outcomes** processed by StateSet across 10 SKUs.
* Manage **payment methods** and view **invoices** without leaving the app.
* Open the **Stripe billing portal** for tax IDs, addresses, and detailed history.

## Shared entitlements

The portal uses the `billing_organizations` Hasura table as the **single source of truth**.
Signing in here means subscriptions show up in ResponseCX, the Computer Use Agent, and the
sandbox — there is no per-product billing state to reconcile.

Module activations and outcome records live in the `org_modules` and `outcomes` tables.

## Outcome SKUs

Billing is outcome-based rather than seat- or token-based: you are billed for work completed,
not capacity provisioned.

An outcome is a verified, end-to-end resolution, priced against the BPO labor it replaces.

**Live:**

| SKU                       | Outcome                                      | Price  |
| ------------------------- | -------------------------------------------- | ------ |
| Triage Outcome            | An enquiry triaged and handed off to a human | \$0.50 |
| Resolved Customer Contact | A support contact resolved end to end        | \$2.00 |

**In development:**

| SKU                            | Outcome                                |
| ------------------------------ | -------------------------------------- |
| WISMO Resolution               | A "where is my order" enquiry resolved |
| Resolved Return / RMA          | A return resolved                      |
| Abandoned-Cart Recovery        | A recovered cart                       |
| Qualified Inbound Lead         | A lead qualified against CRM criteria  |
| Completed B2B Reorder          | A reorder placed                       |
| Resolved Billing Dispute       | A dispute handled                      |
| Successful Upsell / Cross-sell | An upsell completed                    |
| Pre-Purchase Consultation      | A pre-purchase consultation closed     |

<Warning>
  Only the two live SKUs can be billed today. Pricing and availability for the rest are confirmed
  per contract.

  Prices follow the canonical SKU catalog in the ResponseCX platform. The billing portal carries
  its own default list prices that currently **disagree** for several SKUs — where they differ,
  the catalog and Stripe win.
</Warning>

## Disputes

Customers can flag an outcome within **14 days**. Disputes are persisted as Stripe customer
balance transactions — a negative amount is a credit on the next invoice — and the Outcome
Accounting Dashboard renders the ledger.

## Plans

Each plan pairs a monthly platform fee with a per-outcome rate — a larger platform fee buys a
lower rate per outcome.

| Plan           | Platform fee | Per outcome | For                                                     |
| -------------- | ------------ | ----------- | ------------------------------------------------------- |
| **Starter**    | none         | \$2.50      | One channel (Email or Chat), self-service onboarding    |
| **Growth**     | \$5,000/mo   | \$2.00      | All channels, dedicated success manager, priority SLAs  |
| **Enterprise** | negotiated   | from \$1.50 | Volume discounts, dedicated infrastructure, custom SLAs |

<Note>
  Every figure on this page is a **list price**. Per-unit prices are configured in Stripe, not in
  the application, and the portal's displayed price is display-only — **the amount billed always
  comes from Stripe**, with negotiated Enterprise terms overriding list. Check the portal or your
  Stripe dashboard before relying on a number.
</Note>

## Modules

Each module carries a base subscription price (monthly or yearly) plus a metered component:

| Module       | Id             |
| ------------ | -------------- |
| Voice        | `voice`        |
| Chat Widget  | `chat-widget`  |
| Email        | `email`        |
| Computer Use | `computer-use` |

## Stack

| Layer     | Choice                                 |
| --------- | -------------------------------------- |
| Framework | Next.js 14 App Router (TypeScript)     |
| Styling   | Tailwind with `stateset-design` tokens |
| Auth      | WorkOS AuthKit                         |
| Payments  | Stripe                                 |
| Data      | Hasura GraphQL                         |

## Operational controls

The portal carries a set of financial and security controls beyond the basic subscription flow:

* **Financial reconciliation** between Stripe and the local entitlement state.
* **Entitlement resync** so a drifted org can be brought back in line.
* **Dispute handling.**
* **Audit trail** over billing actions.
* **Origin defense** and Redis-backed rate limits.
* **Alerting** and a migration runner.

## Local development

```bash theme={null}
cp .env.example .env.local
# Fill in WORKOS_*, STRIPE_*, HASURA_* env vars

npm install
npm run dev
# → http://localhost:3007
```

## Deployment

Production runs on the Hetzner Kubernetes cluster in the `stateset-billing` namespace, with
images pushed to GHCR. Manifests live in `k8s/`, mirrored by the Hetzner infra repo.

```bash theme={null}
bash scripts/deploy.sh
```

The script is idempotent and safe to re-run. It requires the `stateset-billing-app` Secret to
already exist.

## Related

* [NSR Console & Billing](/stateset-nsr-console) — NSR has its own metered billing, separate from this portal
