Three product changes requested:
1. Free first project per tool on sign-up. Every new (unsubscribed) user now
gets ONE free project per tool for their whole lifetime, before subscribing.
utils/usage.py: added lifetime_usage() and a free-project branch in
project_entitlement (free_base=1 when base==0 and not admin). billing.py now
derives can_create / project_limit from project_entitlement (single source of
truth) and exposes free_projects.
2. Retired the 50 AED Starter tier -> only 3 paid tiers remain (Professional,
Business, Studio). plans_catalog now excludes tier 1, and /checkout rejects
tier 1 with a 400. PLANS[1] is kept only so existing Starter subs still resolve.
3. Landing / About / Dashboard copy: "1st month (2 projects) free" -> "Start your
1st project for free"; free card shows "Your 1st project free / per tool";
paid cards relabelled TIER 1-3; Dashboard start-bar now shows the create form
to users who still have their free project and only p…
Two payment-correctness fixes:
1) Add-ons are now ONE-TIME. Previously the extra-project allowance was added
permanently to the monthly limit, so buying one add-on granted +1 project
EVERY month forever. Now the monthly tier quota resets monthly, and each
add-on credit is consumed only when creating a project beyond that quota
(settle_project_creation + consume_extra_project). check_limit/billing expose
a single can_create gate; the dashboard uses it instead of used>=limit.
2) The checkout fallback used to INSERT a free 'manual' active subscription (or
grant a free credit) whenever create_checkout_session raised. On a transient
Dodo error this silently gave users paid plans they never bought (e.g. a
phantom tier-2 Work Programme = 4 projects). Now, when Dodo is configured,
the failure returns 502 instead of granting anything; the mock path only
runs locally when no Dodo key exists.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Subscriptions and add-ons now activate synchronously on return from checkout
instead of depending on webhooks that were failing silently.
- payments.py: resolve Dodo base URL from API-key prefix (kills test/live env
mismatch); deterministic product_id -> (feature, tier) map; synchronous
force_activate (subscriptions via /subscriptions, add-ons via /payments) with
idempotent grants; log instead of silent except:pass.
- billing.py: new POST /activate endpoint; per-tool extra-project allowance via
extra_projects_for(); feature-access "used" now matches the creation gate;
fix missing safe_execute import.
- usage.py: check_limit uses per-tool add-on column for all tools, not just qto.
- features.py: FEATURE_EXTRA_COL + extra_projects_for() helper.
- Dashboard.jsx: call /activate on payment return (retries, add-on aware);
add-on buttons now buy the correct per-tool add-on instead of a tier-1 sub.
- .env.example: document all 15 products (3 tools x 4 tiers + 1 add-on).
Co-Author…
Add full feature segregation and IDs for Work Programme and Cash Flow