Skip to content

feat(billing): let custom-plan orgs pick a catalog plan - #7862

Merged
pedrofrxncx merged 1 commit into
mainfrom
feat/custom-plan-self-serve
Oct 9, 2026
Merged

pedrofrxncx merged 1 commit into
mainfrom
feat/custom-plan-self-serve

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

What is this contribution about?

Orgs on the contract (custom) plan saw only "Your plan: Custom. Contact us to change it." in Settings → Plans, with no way to move to a catalog plan themselves.

  • Catalog for custom orgs: they now get the same plan cards as everyone else and can subscribe through Stripe checkout. Whether they already have a subscription is read from Stripe, since their gateway plan id says nothing about it. The Custom card is marked as their current plan.
  • Invoice option: orgs flagged invoice_upgrade (and without a live Stripe subscription) also get "Add to my invoice" on Starter/Business. AI_PLAN_INVOICE_UPGRADE no longer requires the AI usage to be exhausted; the flag is the gate. This relaxes the rule added in feat(billing): add to my invoice — contract orgs upgrade at their AI limit #7761 and applies to any flagged org.
  • Staff-managed is now only ai_service: deco's own plan keeps the contact card. Paywalls now quote the next plan up for custom orgs instead of a bare lock.
  • The unused settings.plans.limitReached string is removed.

No ai-gateway change needed: Stripe checkout and the webhook move the org through the gateway's admin plan route, which already accepts custom → starter/business and drops the contract's allowance override on the way out.

How did you verify your code works?

  • bun test apps/api/src/tools/ai-providers/plan-change.test.ts: 7 pass (the test asserting the old usage-exhausted refusal was removed).
  • Web typecheck, oxlint, and knip pass.
  • API typecheck fails at src/mcp-clients/lazy-client.ts:205; the same error reproduces on origin/main without this change.
  • Not checked in a browser yet.

Screenshots/Demonstration

Not captured yet.

How to Test

  1. Put an org on the custom plan through the gateway admin API.
  2. Open Settings → AI providers: the plan catalog shows, with Custom marked as the current plan.
  3. Choose Starter: it opens Stripe checkout.
  4. Add the invoice_upgrade feature override to that org: "Add to my invoice" appears on Starter/Business, and confirming moves the org to that plan.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes (invoice upgrades no longer require exhausted usage)

Summary by cubic

Orgs on the contract (custom) plan used to see only "Your plan: Custom. Contact us to change it." in Settings → Plans. They now see the full plan catalog and can move to a catalog plan themselves: subscribing through Stripe checkout, or — when flagged invoice_upgrade — adding the plan to their deco invoice. Only deco's own ai_service plan keeps the contact card.

  • The Custom card is marked as the current plan, and subscription state is read from Stripe since the gateway plan id says nothing about it.
  • Invoice upgrades are now gated solely by the invoice_upgrade flag; AI_PLAN_INVOICE_UPGRADE no longer requires exhausted AI usage.
  • Paywalls now quote the next plan up for custom orgs instead of a bare lock, and the unused settings.plans.limitReached string is removed.

Written for commit c83e7b8. Summary will update on new commits.

View guided diff

@pedrofrxncx
pedrofrxncx enabled auto-merge (squash) October 9, 2026 19:28
Orgs on the contract (custom) plan saw only "Contact us to change it".
They now get the normal plan catalog and Stripe checkout; flagged
(invoice_upgrade) orgs also get "Add to my invoice", no longer gated on
having spent their AI usage. ai_service keeps the contact card.
@pedrofrxncx
pedrofrxncx force-pushed the feat/custom-plan-self-serve branch from f7f2b28 to c83e7b8 Compare October 9, 2026 21:43
@pedrofrxncx
pedrofrxncx merged commit 23b524a into main Oct 9, 2026
33 checks passed
@pedrofrxncx
pedrofrxncx deleted the feat/custom-plan-self-serve branch October 9, 2026 21:53
decocms Bot pushed a commit that referenced this pull request Oct 9, 2026
PR: #7862 feat(billing): let custom-plan orgs pick a catalog plan
Bump type: minor

- decocms (apps/api/package.json): 4.463.4 -> 4.464.0
- @decocms/native (apps/native/package.json): 4.463.4 -> 4.464.0

Deploy-Scope: both
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