feat(quota): admin-granted paid plans via wallet PlanOverride (no Stripe)#2735
Merged
Conversation
…ipe)
Admins could only "Activate Trial" (a Stripe trial sub), which is wrong for a
customer who paid out-of-band (bank transfer, no card): it's time-limited,
Stripe-managed — so a manual fix gets reverted by Stripe sync — and ties the
account to a trial lifecycle. find-ai/Leah hit exactly this.
Add a Stripe-independent plan grant:
- Wallet.PlanOverride ("pro"|"free"|""); quota honors it over the Stripe-derived
tier in both the org and user paths. Stripe sync only writes subscription_*,
never PlanOverride, so an admin grant can't be reverted by a webhook.
- POST /admin/orgs/{id}/plan to set an existing org's plan.
- "Activate" can grant a paid Pro plan (PlanOverride) as an alternative to the
Stripe trial; for a user with no org yet it stashes PlanOnFirstOrg, consumed
onto their first org's wallet (consumeUserPlanOnFirstOrg, alongside the
existing trial/credit consumers in org creation).
- Frontend: AdminOrgsTable gains a Plan column + set-plan menu (Pro/Free/clear);
ActivateTrialDialog gains a plan selector (Trial vs Paid Pro). Regenerated
API client + swagger.
Tests: quota — PlanOverride=pro grants Pro with no subscription; =free forces
Free over an active sub. go build ./pkg/server/ + go test ./pkg/quota/ green;
yarn build clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Admins could only Activate Trial (a Stripe trial sub), which is wrong for a customer who paid out-of-band (bank transfer, no card): it's time-limited, Stripe-managed (so a manual fix gets reverted by Stripe sync — exactly what happened when I bumped find-ai to
activeand a webhook put it back totrialing), and ties the account to a trial lifecycle. find-ai/Leah hit all of this.Adds a Stripe-independent plan grant:
Wallet.PlanOverride("pro"|"free"|"") — quota honors it over the Stripe-derived tier in both the org and user paths. Stripe sync only ever writessubscription_*, neverPlanOverride, so an admin grant can't be reverted by a webhook.POST /admin/orgs/{id}/plan— set an existing org's plan.PlanOnFirstOrg, consumed onto their first org's wallet (consumeUserPlanOnFirstOrg, next to the existing trial/credit consumers in org creation).Testing
quota_test.go):PlanOverride=pro→ Pro with no subscription;=freeforces Free even over an active sub.go test ./pkg/quota/green.go build ./pkg/server/clean;yarn buildclean.Once this ships, find-ai gets a proper paid plan (
PlanOverride=pro) instead of the spurious trial, and the same admin control covers every out-of-band-paid customer.🤖 Generated with Claude Code