Backend foundation
D1 schema, billing status/plans/checkout/portal routes, Polar webhook ingestion, and provider error handling are on main.
This report is a publishable progress snapshot for Tegy's Polar billing lifecycle. It is not the final purchase walkthrough report. The final report still requires approved lifecycle enforcement, usable Polar sandbox configuration, a completed seat purchase, and verified video clips for every step.
D1 schema, billing status/plans/checkout/portal routes, Polar webhook ingestion, and provider error handling are on main.
Polar production has public monthly seat-based Tegy Pro mapped to product 227f4ece-3491-4af4-8809-38dd9c187275.
The account billing dialog shows the plan, checkout return opens billing, and /api/billing/refresh reconciles customer state after return.
Turn blocking affects the user-to-AI boundary and requires explicit operator approval before implementation.
Polar sandbox login/config is not usable yet, so no verified sandbox card checkout video exists.
| Split | Status | PR / commit | Evidence |
|---|---|---|---|
| Backend foundation | Production | #488 | Billing D1 schema, route handlers, Polar webhook handler, and billing tests. |
| Production product configuration | Production | #491 | Tegy Pro production product, USD 20/month/seat, configured in Worker env. |
| Billing UI | Production | #494 | Account menu billing dialog and checkout return notice. |
| Billing-required UI handling | Production | #496 | Structured HTTP 402 handling opens billing UI without fake assistant content. |
| Lifecycle projection and route tests | Covered | #498 to #502 | Active, canceling, past-due, inactive, webhook signature, dedupe, portal guard, and config-verifier coverage. |
| Checkout-return refresh | Production | #503 / 2c411a9 |
Production asset contains /api/billing/refresh; deployed version e19d7a9d-22ac-4f3e-8b95-dc95cc075ce0. |
| Evidence and runbook | Current | #505 / a7a89cc |
Current ledger and verification runbook document remaining gates and exact verifier output. |
bash scripts/env-run.sh -- env POLAR_SERVER=production tsx scripts/verify-polar-config.ts server: production product lookup: ok product name: Tegy Pro product visibility: public product recurring interval: month product price mode: seat_based
npm run billing:verify-polar-config server: sandbox access token: configured monthly product: configured product lookup: failed error status: 401 error: invalid_token
POLAR_SERVER=sandbox. A
dedicated sandbox token, product, and webhook secret are still required.
https://app.tegy.io/new?billing=plans opens the signed-in Tegy shell and billing dialog./api/billing/status returns HTTP 200 with production Polar config enabled.accessTokenConfigured: true, webhookSecretConfigured: true, monthlyProductConfigured: true, server: production, and enforcement: false.Tegy Pro, USD 20/month/seat, product 227f4ece-3491-4af4-8809-38dd9c187275.The final report must replace these slots with real verified videos. They are listed here so missing evidence remains visible.
Open Tegy as a new user or workspace, use Billing, start Polar checkout, and verify the checkout product and seat quantity.
Complete sandbox purchase, return to /new?billing=success, and show billing refresh projecting active entitlement.
After purchase, submit a real Tegy turn and show a successful assistant response under active entitlement.
Open the customer portal, cancel at period end, and show Tegy state becomes canceling while access remains active.
Trigger or simulate past-due/revoked state, verify inactive access, then recover to active.
Verify production configuration and UI after the final enforcement and sandbox splits are shipped.
| Gate | Required before completion | Current state |
|---|---|---|
| AI-boundary enforcement approval | Explicit operator approval for rejecting unpaid turn submissions before chat hydration, persistence, or container dispatch. | No approval has been given yet; implementation is intentionally held. |
| Polar sandbox access | Usable sandbox organization, token, product, and webhook secret. | Sandbox login remains blocked in the current browser session; production dashboard has no visible sandbox switch. |
| End-to-end purchase proof | Verified sandbox or production purchase from new user to active entitlement and successful Tegy turn. | Pending sandbox access and enforcement approval. |
docs/billing-lifecycle-evidence-2026-06-29.mddocs/billing-lifecycle-verification-runbook-2026-06-29.md