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…
Update UI, add feedback system, extract name from email