feat(billing): payer_ref account edge — slot count-gate + paid-tier credits bypass#268
Merged
Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.