Skip to content

feat(billing): payer_ref account edge — slot count-gate + paid-tier credits bypass#268

Merged
MoltyCel merged 1 commit into
mainfrom
phase2-payer-ref
Jul 16, 2026
Merged

feat(billing): payer_ref account edge — slot count-gate + paid-tier credits bypass#268
MoltyCel merged 1 commit into
mainfrom
phase2-payer-ref

Conversation

@MoltyCel

Copy link
Copy Markdown
Owner

Phase 2 payer_ref edge (accounts + agent_payer + payer_usage_meter, payer_ref on api_keys/billing_subscriptions). Migration 012 already applied to live DB. 13 tests green. Bestand/keyless/free untouched.

…redits bypass

Phase 2: durable Agent->payer edge via opaque payer_ref minted at API-key
signup. New role-owned tables accounts + agent_payer (agents is postgres-owned,
no ALTER) + bounded payer_usage_meter; payer_ref columns on api_keys +
billing_subscriptions. Checkout carries payer_ref -> webhook binds
stripe_customer to the account and stamps the subscription. Registration count-
gate: agents-per-payer vs slot quota (base 2 + $9 add-ons), 402 on overflow;
only payer_ref accounts with an active paid sub are gated (bestand/keyless/free
untouched, create-time only). credit_middleware bypasses the credit rail for
paid tiers (metering retained). AWS fulfillment stamps aws_customer_identifier
as attribution only (Stripe stays the pay path).

Reversible migration 012_payer_ref.sql (up+down). 6 new tests + 7 existing
credit-middleware tests green (13 passed).
@MoltyCel
MoltyCel merged commit f1bc535 into main Jul 16, 2026
6 checks passed
@MoltyCel
MoltyCel deleted the phase2-payer-ref branch July 16, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant