held: card-less Pro trial behind STRIPE_CARDLESS_TRIAL (row 14 of app#2044)

Draft
SW
3mo ago
+2252-3

Held. Row 14 of recoupable/app#2044 is explicitly deferred: only worth enabling if checkout_opened → subscription is still zero a month after rows 1 to 9 ship. This draft exists so the row has a PR attached and the switch is one env var away; it must not merge before that decision. Stacked on #878 (and #876).

What it does

cardlessTrialParams(trialPeriodDays) returns {} unless STRIPE_CARDLESS_TRIAL=true. When on, every Pro trial Checkout (both POST /api/subscriptions/sessions and POST /api/subscriptions/checkout) is created with payment_method_collection: "if_required" and subscription_data.trial_settings.end_behavior.missing_payment_method: "cancel", so a buyer can start the 30-day trial without a card and a trial that ends without one cancels (the account falls back to Free) rather than failing a charge. Starter (no trial) is untouched.

Not included, on purpose: the day-20 in-app card prompt with the usage summary (app repo; specced on the issue) and the docs change. Both come with the real row when it is un-held.

Tests

Red first: cardlessTrialParams (off by default, on only for "true" and only with a trial), plus a createCheckoutSession case under the flag. vitest run lib/stripe green; tsc --noEmit and eslint clean.

No preview verification: the flag is off on every environment, so the preview behaves exactly like #878.


Summary by cubic

Held for row 14 of app#2044: adds the card-less Pro trial behind STRIPE_CARDLESS_TRIAL so enabling it later is one env var away.

  • With STRIPE_CARDLESS_TRIAL=true, Pro trial Checkout sessions use payment_method_collection: "if_required" and cancel the trial at its end if no payment method was added, so the account falls back to Free instead of failing a charge.
  • With the flag off or unset, Checkout behavior is unchanged; Starter and non-trial sessions are untouched.
  • Applies to both POST /api/subscriptions/sessions and POST /api/subscriptions/checkout.
  • The day-20 in-app card prompt and the docs update are intentionally not included; they belong with the un-held row.

Rollout

  • Do not merge until rows 1 through 9 have shipped and the deferred decision is made.