Repository navigation
Say before checkout when no card trial is available and the plan is billed today - #1081
Merged
Merged
Conversation
…s billed today An address that already had an AnythingMCP subscription gets no card trial from the licence site, so Checkout charged it today while /start-trial said "€0 today". The app now asks first (GET /api/license/card-trial-eligibility, backed by the site's subscription-history lookup) and shows a pay-today page with the plan price; checkout-link stops asking for a trial for those addresses and reports whether the site granted one, so the page also catches a late refusal. The trial banner, the licence settings and the post-Approve line no longer promise "no charge before" to them. The /start-trial page shows the real trial end date instead of "7-day".
8 tasks done
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
An address that already had an AnythingMCP subscription gets no card trial from the licence site (
hasHadSubscriptionin its checkout-intent), so Stripe Checkout charged it today. The app only learned that at Checkout:/start-trialsaid "€0 today", the trial banner said "no charge before …", and so did the licence settings and the post-Approve line. This makes all of them say the truth before checkout.The site already exposes the same lookup to the Cloud (
POST /api/license/subscription-history, service token, used by the win-back), so no new site endpoint is needed. Website side: HelpCode-ai/anythingmcp-website#380 moves the decision into one tested function (cardTrialGranted) that both paths share.Changes
CardTrialEligibilityService(license/card-trial-eligibility.service.ts):forAdmin()→trial(running trial, 48 h left, address never had a subscription or the site could not answer),pay(had a subscription: plan starts and is billed today),none. Answers cached 10 min per address; "unknown" is never cached. The site is only asked when a card trial would otherwise be offered.GET /api/license/card-trial-eligibility(Cloud, ADMIN; 404 on self-hosted).POST /api/license/checkout-link: notrialEndis requested for an address that had a subscription, and the response now carriestrial(whether the site granted it), read from the intent's answer./start-trial: pay-today variant for those addresses. Heading "Keep your workspace running"; "This email address has had an AnythingMCP subscription before, so a new free trial is not available with a card. Your plan starts today and is billed today. …"; footnote "Starter, 19 €/month, billed today and then every month. Secure checkout by Stripe. Cancel anytime from the billing portal."; button "Continue to checkout" (a plain purchase). No "€0 today" and no trial wording./start-trial: eyebrow "Free until 18 October 2026", heading "Your free trial", body "Every feature, free until 18 October 2026 …" (the card trial ends with the free trial, so 7 days was not true after day 1)./start-trial) instead of "Add a payment method, no charge before …" for those addresses. It no longer goes straight to Checkout for them. The em dashes in the banner copy are gone.Unknown history keeps today's behaviour (trial wording). The site checks again at checkout, and the safety net catches a refusal.
Type
Testing
Added/updated unit tests
Tested manually
packages/backend:npx tsc --noEmitclean;npm test553 suites, 14,203 tests passed;npm run lint0 errors (11 existing warnings). New:card-trial-eligibility.service.spec.ts(trial/pay/none, unknown, cache TTL, batch);license-checkout.spec.ts(no trial asked for a past subscriber, unknown still asks,trialflag from the site);login.controller.spec.ts(line left out for a past subscriber, never waits more than 1.5 s).packages/frontend:npx tsc --noEmitclean; lint 0 errors (26 existing warnings). Playwrightcard-trial.spec.ts18 passed (3 new: pay-today page with price and a plain purchase; late refusal at checkout; banner "Choose a plan"), plusbilling-awarenessandneutral-signup-and-billinggreen.Website chore(deps-dev): bump autoprefixer from 10.5.0 to 10.5.2 #380: 249 tests passed.
Related Issues
HelpCode-ai/anythingmcp-website#380 · #1078 builds on this branch (its first-success offer skips admins whose address cannot start a trial).