Repository navigation
feat(billing): card-required Pro free trial with a capped allowance - #10330
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
1 issue found across 47 files
Confidence score: 3/5
freeTierEligibleinapps/sim/lib/billing/trial.tscan allow trial checkout for accounts that have already used their free allowance. Check effective free usage before returning trial checkout.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/billing/trial.ts">
<violation number="1" location="apps/sim/lib/billing/trial.ts:56">
P2: This gate does not exclude accounts that have already spent their free allowance. `freeTierEligible` only tracks deleted-identity reuse, so check the account's effective free usage before returning trial checkout parameters.</violation>
</file>
This PR changes payment, billing, or quota logic. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
[High impact] The latest changes appear safe to merge, with no new blocking issues found. SummaryAdds a card-required Pro trial with a fixed allowance, trial-aware billing checks, and updated billing copy.
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 51 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
New personal Pro subscribers get a 14-day trial at checkout with a card collected up front. The trial counts as Pro (features and Sim-hosted keys) under a fixed 2,000-credit allowance: no weekly refresh, no on-demand usage, no overage billing, and no team conversion until it converts. Each card and each account starts one trial; a reused card ends the trial at once so the card is charged.
…ap trial credit grants
d84ec28 to
5bc9db9
Compare
Summary
subscription_data.trial_period_days).getProTrialCheckoutParams. Only the Pro tier on a personal reference qualifies, for an account that has never trialed or held a subscription and still holds its free allowance. Abandoned checkouts don't count against it.enforceOneTrialPerCardruns when checkout completes.trial_cardtable. A claim outlives account deletion (user_idset null).trial_end: 'now'), so Stripe charges the card.trialingjoins the entitled and usable statuses, so a trial gets Pro features and Sim-hosted keys.PRO_TRIAL_USAGE_LIMIT_DOLLARS(2,000 credits).syncUsageLimitsFromSubscriptionsets it exactly, which also lowers a stale higher limit, and raises it to the plan base on conversion.getSubscriptionWeeklyRefreshDollars.canEditUsageLimitis false,updateUserUsageLimituses it, and the UI separatescanManageBillingfromcanEditUsageLimit.billsOveragegates threshold billing and the capped-payer mid-run checks.calculateSubscriptionOveragereturns 0 for a period inside the trial.SETTLED_SUBSCRIPTION_STATUSES, which matches the partial index predicate, so a trial period is never closed or billed.payerBillsOverage, so trial payers are capped on that path too. Older decisions fall back to the previous rule.0470_pro_trial_card: a new table only.Type of Change
Testing
lib/billing/trial.integration.ts(real Postgres, Stripe stubbed), 16 cases:mid-run-usage.test.ts: capped payer on attributed runs and on direct-v1 runs (with and without the overage flag).billing.test.ts: overage for a trial period vs a period past the trial.threshold-billing.test.ts: a trial never bills.utils.test.ts: no weekly refresh during a trial.validate/route.test.ts: the account decision header carries the overage flag.bun run lint,check:migrationsand the generators. CI runs type-check and the full audits.Checklist
test-auditauthoring gate)