feat: Tracking & Billing, Polar - #6924
Merged
Merged
Conversation
Organizations need self-serve hosted credit, BYOK model lists, and
factory spend limits. Polar handles checkout and invoices. SuperPlane
keeps the usage ledger and remaining-credit wallet.
Organization settings now live at /{org}/organization so LLM spend and
Integrations sit next to workspaces instead of inside a factory URL.
Signed-off-by: André Calil <andre@calil.com.br>
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
👋 Commands for maintainers:
|
superplane-policy-bot
Bot
requested review from
forestileao,
lucaspin and
shiroyasha
August 26, 2026 17:45
Contributor
|
Storybook available at https://pr-6924-storybook.superplane.workers.dev |
Polar signs with the full secret bytes. An empty secret or a non-pack checkout can grant credit incorrectly or charge without a wallet grant. This change rejects those cases, keeps factory models in the parent list, and splits duplicated settings UI so lint stays in budget. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
Turning off No limit seeded $0.00 and mapped empty input to zero, so Save could block all SuperPlane-hosted runs. Empty BYOK models skipped the allowlist. Also add billing and model tests so coverage stays in budget. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
…5-and-6-polar Co-authored-by: Cursor <cursoragent@cursor.com>
Factory allowlist saves left the canvas model picker stale. Checkout accepted a customer IP from the request body. The credit return page showed success after one fetch. Invalidate picker queries after model saves. Wait for the canvas factory before the list. Use only proxy headers for checkout IP. Snapshot the grant and poll until it increases. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
The credit return hook listed a whole args object in an effect dependency check. The canvas factory mock failed TypeScript. Destructure the hook inputs for the effect deps. Type the canvas mock so the factory wait tests compile. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
A second org for the same owner failed Polar unique-email checks. Permanent webhook errors returned 500 and Polar disabled the endpoint. Refunds left SuperPlane credit in place. Give each org a unique Polar team email. Accept poison-pill events with 202. Reverse Polar grants on order.refunded. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
A refund could skip a grant when pack metadata was missing. A refund that arrived before order.paid returned 202, so Polar did not retry. grpc-gateway hid Cloudflare client IPs from tax. Reverse an existing Polar grant even without pack metadata. Return 500 until the grant exists. Read gateway Cloudflare IPs. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
The spend page labeled Polar packs as SuperPlane grant. Polar team portal sessions failed without a member id. Keep SuperPlane grant as welcome plus admin credit. Show purchased credit from Polar packs. List Polar orders. Open the Polar portal with the organization external id and the owner member. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
…5-and-6-polar Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # db/structure.sql # web_src/src/App.tsx # web_src/src/lib/startDirectGitHubConnect.ts
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5efc7a7. Configure here.
Concurrent Polar refunds with different ids could reverse more than the purchase grant. Hosted runs now use the same factory model list as BYOK. Split HostedCreditSummaryCard so ESLint complexity stays inside the budget. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
golang-migrate records only the newest version. Three Polar migrations were older than work-order origin from main, so production would skip them. Recreate those files with later timestamps so they apply after the merge. Signed-off-by: André Calil <andre@calil.com.br> Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Aug 28, 2026
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
This change lets organizations buy SuperPlane-hosted LLM credit and control which models each factory can use.
/{org}/organization/{tab}. LLM spend and Integrations live there. Old LLM spend URLs redirect.Test plan
/{org}/organization/llm-spendand confirm remaining credit and model spend.?credit=added./{org}/settings/llm-spendredirects to organization LLM spend./{org}/settings/integrationsstill opens the old catalog.Made with Cursor