Repository navigation
feat(billing): add email usage grants and attributed credit removal - #10782
Draft
mzxchandra wants to merge 1 commit into
Draft
mzxchandra wants to merge 1 commit into
mzxchandra wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
mzxchandra
force-pushed
the
codex/grants-s2-email-credits
branch
from
December 5, 2026 08:50
295227d to
bc62b88
Compare
1 task done
This branch was previously deployed
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.
Summary
Admins can issue, edit, list and bulk-import email-matched usage-credit grants through the shared API. A verified recipient who owns an eligible paid organization can claim each award once. Intentional repeat awards are supported; permanent issuance keys prevent duplicate retries.
Adds
email_credit_grantand immutableusage_credit_entryreceipts. Existing organization settlement paths consume oldest claimed grants first, then other credit. Full or partial removal takes effect in the request transaction, returns a final result and preserves purchased/legacy balance. In-flight costs arriving later use remaining funding or ordinary overage; no producer-registration barrier or pending-removal finalizer is introduced. Credits remain usage-only.Stacked on #10781. Sponsorship, fresh-org setup and paid continuation are later slices.
Storage and rollout
Additive migration 0492; no historical credit-provenance backfill. Live org/user references use SET NULL with retained claim snapshots; financial entries restrict grant deletion. Native checks enforce conservation and valid lifecycle state. Before the first claim, deploy source-preserving debit writers and verify relevant old writers have drained. Rollback after claims must retain attributed debits.
Testing
Type of Change