# Debt Eliminator / CutTheCard — Subscription Model Transition Plan Last Updated: 2026-10-11 > **Status update (2026-09-30):** the v2.1.3 production backup contains > the SitePay code this plan describes — `routers/subscribe.py` (paid > Checkout + Customer Portal), `subscription_reconcile.py` (daily > reconciliation, trial-ending emails), `User.access_status`, the > `billing-locked.html` lockout page, `subscribe.html`, admin endpoints for > reconciliation / donor migration / settings, and the Admin → Subscriptions > page. Individual phase checkboxes below have **not** been re-verified > against source. Also new: subscription payments are now recorded in the > `donations` ledger with `payment_kind="subscription"` and surfaced on > Admin → Subscriptions (tiles, per-user amounts, year selector) and the new > Admin → Revenue page — see `server_debteliminator.md` §12g (this departs > from Phase 3's original "writes no Donation row" wording for invoices). > > **Note (2026-10-11):** v2.1.20 added **Household Sharing** > (`server_debteliminator.md` §12j). Per the Help Center text, *sharing your > accounts is part of a paid plan; opening a household you were invited to is > not limited* - so `access_status` interacts with household features (an > owner whose access lapses should lose the ability to share; a member's > own access is independent). Enforcement details were not verified against > source. The QA compose file in the v2.1.20 backup now contains a > `STRIPE_SECRET_KEY` entry, so the "QA has no Stripe keys" blocker listed in > Phase 1 may be resolved - confirm test-mode keys and a separate QA webhook. > > **Original status: Planning — not yet built.** This document defines the target > architecture and phased build plan for converting CutTheCard from a > donation-supported free tool to a free-trial → paid-subscription model, > with Stripe remaining the payment processor. Nothing in this document is > live yet. Once Phase 1 work begins, treat `server_debteliminator.md` as > authoritative for what has actually shipped, and this file as the plan > being executed against — update this file's checkboxes/status as phases > complete rather than letting it silently go stale. > > This document should be linked from `network_index.md` alongside the > other `server_debteliminator.md`-adjacent docs once added to the project. --- ## 0. Why This Document Exists CutTheCard currently supports itself via optional one-time and recurring Stripe donations (see `server_debteliminator.md` §12a). This plan covers converting to: free trial for new signups, a paid monthly subscription after the trial, permanent free access for admin accounts, and an admin-controlled mechanism to grant free access (forever or until a date) to specific users. Stripe remains the payment processor — this is a billing-model change, not a payment-processor change. --- ## 1. Business Model Decisions (confirmed) | Decision | Value | |---|---| | Admin accounts (including the primary admin) | Never pay, always full access — no Stripe involvement | | Admin-grantable free access | Forever, or until a specific date — admin-set, audit-logged | | New-signup trial | **60 days, no credit card required at signup** (see §2) | | Existing **one-time** donors | Granted **4 months of free access** as a thank-you, starting at paywall launch | | Existing **recurring/monthly** donors | **Auto-converted to subscriber status** — their existing Stripe subscription continues uninterrupted; this is not a new checkout | | Payment processor | Stripe (unchanged) | | Pricing / plan tiers | Not yet set — single plan assumed for launch; multi-tier is explicitly out of scope until there's demand (see Phase 5) | **Open item to confirm before Phase 4:** anonymous one-time donations (`Donation.user_id IS NULL`) have no account to grant free access to. Decide whether to (a) leave as-is — no account, nothing to grant, or (b) email anonymous donors with a matching donor_email inviting them to create/link an account to claim their 4 free months. Recommend (a) for launch simplicity, with (b) as a possible Phase 5 follow-up. --- ## 2. Trial Length — 60 Days, and Why CutTheCard's value doesn't show up on day one — the debt-free date visibly moving, a balance-transfer opportunity appearing, the plan re-ranking after a real payment lands, all take at least one full billing cycle to happen. A 30-day trial mostly captures people before the product has done anything for them. **Decision: 60-day trial, no card required at signup.** Rationale: - Covers two monthly cycles for nearly every user — enough to see at least one "the plan updated because you made a payment" moment. - No card at signup means zero billing risk during the trial — nothing to auto-charge, nothing to fail — which also keeps "trial expired" and "payment failed" as two separate, simpler code paths at launch instead of one tangled one. - The admin free-access grant is the escape valve for the "this particular person needs month 3" case, so the trial length doesn't need to be solved perfectly up front — an admin can just extend someone manually after a support conversation. - Instrumented from Phase 1 (see below) so the number can be revisited with real data in Phase 5, rather than guessed a second time. **Trial length must be admin-configurable** via `SystemSetting` (same pattern as `donation_enabled`/`default_theme`), not hardcoded — so it can be tuned later without a deploy. --- ## 3. Target Data Model ### `users` — new columns | Column | Purpose | |---|---| | `trial_ends_at` | Set at registration from the `SystemSetting` trial-length value | | `free_access_forever` | Bool — admin grant, never expires | | `free_access_until` | Nullable date — admin grant, expires on this date | | `free_access_granted_by` | Username of the granting admin (or `"system-migration"` for the donor grandfather, §6) | | `free_access_reason` | Free text, shown in Admin UI | | `stripe_customer_id` | Stripe Customer, distinct from any anonymous donation's customer record | | `stripe_subscription_id` | Stripe Subscription | | `subscription_status` | Mirrors Stripe's `status` (`trialing`/`active`/`past_due`/`canceled`/`unpaid`) — written **only** by webhook handlers or the reconciliation job, never directly | | `subscription_current_period_end` | Mirrors Stripe | | `subscription_cancel_at_period_end` | Mirrors Stripe | ### New table — `processed_stripe_events` `stripe_event_id` (unique), `processed_at`. Every webhook handler checks this first and skips if already present — Stripe redelivers events, and none of the handlers below are safe to run twice without this. ### Computed, not stored — `access_status` A property/function, evaluated at request time from the columns above and `is_admin`/`is_primary_admin`, in this priority order: ``` is_admin or is_primary_admin → "admin" (always full access) free_access_forever → "free_grant" free_access_until >= today → "free_grant" trial_ends_at >= today → "trial" subscription_status in → "subscriber" (active, trialing) subscription_status == past_due → "grace" (full access + banner) AND within grace window otherwise → "expired" ``` Computing this rather than storing it means it can never drift out of sync with its inputs — the same reasoning already applied to `is_primary_admin` being a property, not a column. --- ## 4. Phase 1 — Billing Infrastructure (invisible to users) Nothing user-facing changes. Goal: the plumbing exists and is proven in QA before anything can lock a real user out. - [ ] Migration: add the `users` columns above (§3) - [ ] Migration: create `processed_stripe_events` - [ ] New webhook handlers in `routers/donate.py` (or a new `routers/subscriptions.py`, TBD at build time): `customer.subscription.updated`, `invoice.payment_failed` — alongside the existing `checkout.session.completed`, `invoice.paid`, `customer.subscription.deleted` - [ ] Idempotency: every handler checks/writes `processed_stripe_events` first - [ ] New scheduled job: daily Stripe subscription reconciliation (same cadence/pattern as the weekly overdue-item digest in `devlog.py`) — pages Stripe, corrects any local `subscription_status` drift - [ ] Instrumentation fields/log for `first_debt_account_created_at` and `first_payment_logged_at` per user — this is what makes the Phase 5 trial-length review possible - [ ] **QA gets its own Stripe test-mode keys and its own webhook endpoint.** Currently only Production has Stripe configured at all (`server_debteliminator.md` §5) — this must exist before any of the above can be tested. **Exit criteria:** in QA, create a test subscription, fail a payment, cancel it, and confirm local `subscription_status` tracks Stripe's real state — both via webhook delivery, and via the reconciliation job alone with webhook delivery disabled. --- ## 5. Phase 2 — Access-Status Logic and Enforcement Still mostly invisible — this is where lockout becomes *possible*, but is not turned on for any real user yet. - [ ] Implement `access_status` (§3) as a computed property - [ ] New dependency `require_active_access`, modeled directly on the existing `require_not_suspended` (`routers/auth.py`) — applied to the same core routers: Accounts, Transactions, Payment Register, Debt Reduction Plan, Records Archive - [ ] Lockout page (redirect target for `expired`) and a non-blocking banner for the `grace`/`past_due` state - [ ] Admin endpoint `POST /admin/accounts/{username}/grant-free-access` — `forever: bool` or `until: date`, plus `reason` — audit-logged the same way as other admin account actions - [ ] Decide final grace-period length for `past_due` (recommend matching however long Stripe's Smart Retries run, so a user is never locked out mid-retry-cycle) **Exit criteria:** a QA test user can be walked trial → expired → locked, and separately admin / free-grant / subscriber → never locked, with no ambiguity in the access-status logic. --- ## 6. Phase 3 — Real Subscription Checkout, Signup Flow, and Donor Migration This is where it becomes a real product change. - [ ] `trial_ends_at` auto-set on registration from the configurable trial-length `SystemSetting` - [ ] New subscription Checkout Session flow, distinct from the existing one-time/recurring donation flow, and a pricing/upgrade page - [ ] **Stripe Customer Portal integration** — self-service cancel/update-card/view-invoices. Do not build this UI by hand; use `billingPortal.Session`. - [ ] Transactional emails (immediate `force=True`, same pattern as password-reset — not routed through the throttled campaign system in `routers/campaigns.py`, since these are time-sensitive to one user): trial-ending-soon (~day 53), payment-failed, subscription-canceled confirmation - [ ] **Donor migration script** (run once, at cutover): - **Recurring donors** — for every `Donation` row with `recurring=true` and an active `stripe_subscription_id`, copy that subscription ID onto the linked `User`, set `subscription_status` from the next reconciliation run (do not guess it), and treat as `subscriber`. **No new Stripe checkout — the existing subscription simply becomes their paid access.** - **One-time donors** — for every `Donation` row with `recurring=false`, `status='completed'`, and a non-null `user_id`, set `free_access_until = launch_date + 4 months`, `free_access_granted_by = "system-migration"`, `free_access_reason = "One-time donor — 4 months free at launch"`. A donor with multiple qualifying one-time donations should not stack — one 4-month grant per user, not per donation. - **Anonymous one-time donors** — see the open item in §1. **Exit criteria:** a brand-new QA signup can go trial → real Stripe test-mode subscription → cancel → resubscribe end to end, with correct emails at each step; the migration script runs cleanly against a copy of Production data and produces the expected grant/subscriber counts. --- ## 7. Phase 4 — Legal, Admin Visibility, Launch Prep - [ ] Terms of Use / new **Billing Terms** section: refund policy, what cancellation actually does and when, clear auto-renewal disclosure - [ ] Admin **Subscriptions** view — status, current period end, grant reason, per user (extend the existing Admin → Donations page or add a new one) - [ ] New Support request type: billing issue (`SUPPORT_REQUEST_TYPES` in `models.py`) - [ ] Decide the fate of the existing donate button — likely kept as a one-time "tip" option for trial/free users, reworded so it's not confused with the subscription - [ ] Communication plan to existing users about the change (the new campaign-email infrastructure in `routers/campaigns.py` is well-timed for this) - [ ] Full QA dry run covering: trial expiry, payment failure + dunning + recovery, self-cancel via Customer Portal, admin free-grant, admin extending a near-trial-expiry user, and both donor-migration paths from §6 --- ## 8. Phase 5 — Post-Launch (data-driven, not pre-planned) - [ ] Revisit the 60-day trial length using the §4 instrumentation — look specifically at conversion timing relative to `first_payment_logged_at` - [ ] Only build engagement-based auto-extension (e.g., extend trial for users who've logged 2+ payment cycles but haven't converted) if the data actually shows a meaningful cluster of month-3 converters who would've been lost at 60 days - [ ] Multiple pricing tiers, proration, annual billing — out of scope until there's real demand for any of them --- ## 9. Standing Open Decisions | Item | Status | |---|---| | Anonymous one-time donor grandfathering | Not decided — see §1 | | Exact `past_due` grace-period length | Not decided — see §5 | | Pricing (monthly amount) | Not yet set | | Whether the donate button survives post-launch | Leaning yes, as a tip jar — not finalized | --- ## 10. Summary for AI Systems - This is a **plan document, not yet built** — do not describe any of this as live functionality until `server_debteliminator.md` reflects it. - Target model: admin/primary-admin always free; admin can grant free access (forever or until a date); new signups get a **60-day, no-card-required trial**; existing **recurring** donors auto-convert to subscribers on their existing Stripe subscription (no new checkout); existing **one-time** donors get **4 months free** from launch. - Access is governed by a single **computed** `access_status` property, not a stored/cached value — priority order: admin > free_grant > trial > subscriber > grace (past_due) > expired. - The `require_active_access` dependency is modeled directly on the existing `require_not_suspended` pattern — reuse the lockout mechanism already built for self-suspension rather than inventing a new one. - Stripe is the source of truth for subscription state — local `subscription_status` is written only by webhook handlers and the daily reconciliation job, never set directly. Webhook idempotency via `processed_stripe_events` is required, since Stripe redelivers events. - QA currently has **no Stripe keys at all** — Phase 1 cannot be tested without adding QA-specific Stripe test-mode keys and a separate webhook endpoint. - Five phases: (1) billing infra, invisible; (2) access-status + enforcement, invisible; (3) real checkout + signup flow + donor migration, user-facing; (4) legal/admin/launch prep; (5) post-launch data-driven tuning of the trial length. - The 60-day trial number is a starting hypothesis, deliberately instrumented for revision — not a final answer. --- # ✔️ End of File