Skip to content

Add Enterprise Stripe invoicing#101

Draft
Gajesh2007 wants to merge 3 commits into
masterfrom
codex/enterprise-stripe-invoicing
Draft

Add Enterprise Stripe invoicing#101
Gajesh2007 wants to merge 3 commits into
masterfrom
codex/enterprise-stripe-invoicing

Conversation

@Gajesh2007
Copy link
Copy Markdown
Member

Summary

  • Add admin-gated Enterprise postpaid billing with cadence, editable Net terms, credit limits, reservations, accrual, rounding carry, and invoice state.
  • Wire Enterprise billing through inference paths so active Enterprise accounts bypass prepaid debit while completed usage accrues postpaid and provider/platform/referral accounting still runs.
  • Add Stripe invoice/customer support, invoice webhook handling, admin/user APIs, console billing display, and scripts/admin.sh enterprise helpers including --terms-days.
  • Add focused store, billing, API, and console tests for Enterprise setup, reservation/cap behavior, invoice lifecycle, terms validation, and UI/status rendering.

Review hardening

  • Fail closed on Enterprise lookup errors and enforce open invoices + accrued + reserved + rounding carry + estimate <= credit_limit.
  • Make reservations idempotent by account/amount, cap finalized actuals to reserved amounts, and release exposure exactly once on terminal invoice states.
  • Persist local draft invoices before Stripe side effects and include pending invoice items when creating Stripe invoices.
  • Preserve omitted admin update fields, reject malformed invoice-run JSON, and keep below-cent accrued usage carried forward.

Validation

  • cd coordinator && GOCACHE=/tmp/go-build go test ./internal/store ./internal/billing ./internal/api
  • cd coordinator && GOCACHE=/tmp/go-build go test -count=1 ./cmd/coordinator
  • cd console-ui && npm test -- billing
  • cd console-ui && npx eslint src/ __tests__/billing-enterprise.test.tsx (passes with existing warnings, 0 errors)
  • git diff --check

Notes

  • Draft PR because this is a broad billing stack change and should get human product/security review before merge.
  • Live Postgres integration was not run because DATABASE_URL is not configured in this worktree.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
d-inference Ready Ready Preview Apr 29, 2026 2:26pm
d-inference-console-ui-dev Ready Ready Preview Apr 29, 2026 2:26pm
d-inference-landing Ready Ready Preview Apr 29, 2026 2:26pm

Request Review

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