New script backend/scripts/setup-stripe.ts that:
- Reads STRIPE_SECRET_KEY from .env
- Detects test vs live mode and warns + 5s delay for live
- For each plan (Essentiel 3EUR/mo, Premium 5EUR/mo):
- Looks up existing price by lookup_key (freedge_essential_monthly,
freedge_premium_monthly) — idempotent, safe to re-run
- If missing, creates the product then the recurring price with the
lookup_key and nickname for clarity
- Prints the resulting price IDs with their env var names
- With --write-env flag, automatically upserts the values into
backend/.env preserving other lines
- Points to Customer Portal settings and stripe listen command as
next steps
npm scripts added:
- npm run stripe:setup # dry run, just print IDs
- npm run stripe:setup:write # update .env automatically
- npm run stripe:listen # shortcut for stripe CLI webhook forward
Updated README to show the script as the recommended path for step 1,
keeping the manual dashboard instructions as a fallback.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>