Skip to content

Say before checkout when no card trial is available and the plan is billed today - #1081

Merged
helpcodeai merged 1 commit into
mainfrom
helpcode/truthful-card-trial
Oct 13, 2026
Merged

helpcodeai merged 1 commit into
mainfrom
helpcode/truthful-card-trial

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

An address that already had an AnythingMCP subscription gets no card trial from the licence site (hasHadSubscription in its checkout-intent), so Stripe Checkout charged it today. The app only learned that at Checkout: /start-trial said "€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: no trialEnd is requested for an address that had a subscription, and the response now carries trial (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.
  • Safety net: if the site still refuses the trial at checkout (e.g. the pre-check could not reach it), the page does not redirect. It switches to the pay-today wording with "This address already had a subscription, so the checkout will charge 19 € today." and continues only on a second click.
  • No more "7-day" on /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).
  • Trial banner: "Choose a plan" (to /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.
  • Licence settings: "Choose a plan to keep AnythingMCP Cloud running after your trial. This address has had a subscription before, so the plan starts and is billed when you check out."
  • Post-Approve line ("Nothing is charged before …"): left out for those addresses. The site gets 1.5 s; no answer keeps the line, as before.

Unknown history keeps today's behaviour (trial wording). The site checks again at checkout, and the safety net catches a refusal.

Type

  • Bug fix

Testing

  • Added/updated unit tests

  • Tested manually

  • packages/backend: npx tsc --noEmit clean; npm test 553 suites, 14,203 tests passed; npm run lint 0 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, trial flag 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 --noEmit clean; lint 0 errors (26 existing warnings). Playwright card-trial.spec.ts 18 passed (3 new: pay-today page with price and a plain purchase; late refusal at checkout; banner "Choose a plan"), plus billing-awareness and neutral-signup-and-billing green.

  • 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).

…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".
@helpcodeai
helpcodeai merged commit 5751567 into main Oct 13, 2026
14 of 15 checks passed
@helpcodeai
helpcodeai deleted the helpcode/truthful-card-trial branch October 13, 2026 16:46
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant