feat: Feature 3.4 — Stripe integration with founder code system

Subscription billing:
- POST /api/stripe/checkout — creates Stripe Checkout session
- POST /api/stripe/webhook — handles lifecycle events (raw body)
- POST /api/stripe/portal — customer self-service management
- GET /api/stripe/status — current subscription info

Founder code system:
- Validates codes against env var list with expiry date
- Routes to founder Stripe Price IDs (locked rate for life)
- 4 price objects: analyst, analyst-founder, desk, desk-founder

Webhook events handled:
- checkout.session.completed → tier update + founder status
- customer.subscription.deleted → revert to free tier
- invoice.payment_failed → logged

Lazy Stripe init (no API key required at import time).
Raw body middleware for webhook signature verification.

16 new tests, 237 total (210 Node.js + 27 Python), all passing.
Phase 3 Web MVP COMPLETE. All roadmap features shipped.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-03-22 10:30:42 -04:00
parent 850fe60e8f
commit eb443232fb
8 changed files with 525 additions and 40 deletions
+28 -38
View File
@@ -4,7 +4,7 @@
2026-03-22
## Current Phase
Phase 3 — Web MVP (IN PROGRESS)
Phase 3 — Web MVP (COMPLETE)
## What Has Shipped
@@ -13,41 +13,35 @@ Phase 3 — Web MVP (IN PROGRESS)
- Feature 1.2 — NBA_API Stats Wrapper (FastAPI microservice)
- Feature 1.3 — Prop Analysis Engine (6-step grading pipeline)
- Feature 1.4 — Database Schema (9 tables, RLS, triggers)
- Feature 1.5 — Bet Submission (3 methods)
- Feature 1.5 — Bet Submission (3 methods + performance tracking)
### Phase 2 — Core Product (COMPLETE)
- Feature 2.1 — Parlay Scan (correlation detection, monetization)
- Feature 2.2 — Line Movement + Cascade Detection
### Feature 3.1Landing Page + Blog (COMPLETE)
- Next.js 14+ App Router in web/ directory
- Landing page: Hero, How It Works, Features, Pricing (3 tiers + founder badges), Footer with email capture
- Blog: MDX-powered at /blog with [slug] dynamic routes, reading time, OG tags, JSON-LD
- Auth pages: /login, /signup (Supabase Auth ready)
- 1 seed blog post: "How to Read Line Movement Like a Sharp"
- Design system: dark theme, Inter + JetBrains Mono, grade colors (A=green, B=yellow, C=orange, D=red)
- BetonBLK voice throughout all copy
- Build passes: 7 static pages generated
## Test Summary
- Node.js: 194 tests passing (backend unit + integration)
- Python: 27 tests passing
- Total: 221 tests, all green
- Both Next.js builds: clean
## What's Next
- Feature 3.2 — Scan UI (/scan page)
- Feature 3.3 — Bet Tracker UI (/tracker page)
- Feature 3.4 — Stripe Integration
### Phase 3 — Web MVP (COMPLETE)
- Feature 3.1 — Landing Page + Blog (Next.js, MDX, BetonBLK voice, SEO)
- Feature 3.2 — Scan UI (leg builder, grade results, upgrade pitch)
- Feature 3.3 — Bet Tracker (performance dashboard, quick slip, settle flow)
- Feature 3.4 — Stripe Integration (checkout, webhooks, portal, founder codes)
## Also Shipped (Separate Repo)
### Mastermind Agency Site
- Next.js 14+ at /home/kev/mastermind/agency-site/
- Glitch aesthetic: scan lines, CRT flicker, RGB split, noise grain
- JetBrains Mono throughout, cyan/magenta accents on dark (#050505)
- Pages: Home (hero + services + projects + process + contact), BetonBLK case study, Contact
- Respects prefers-reduced-motion
- Build passes: 5 static pages generated
- `/home/kev/mastermind/agency-site/`
- Glitch aesthetic, scan lines, CRT flicker, JetBrains Mono
- Home, BetonBLK case study, Contact pages
## Test Summary
- Node.js: 210 tests passing (unit + integration)
- Python: 27 tests passing
- Total: 237 tests, all green
- Both Next.js projects build clean
## All Features Complete
Every feature on the roadmap has shipped:
- 7 backend features (Phase 1 + 2 + 1.5)
- 4 frontend features (Phase 3)
- 1 separate agency portfolio site
## Active Blockers
- BLOCKER-003: WSL2 DNS cannot resolve *.supabase.co
@@ -60,13 +54,9 @@ Phase 3 — Web MVP (IN PROGRESS)
- 221 backend tests passing
### Session 7 — 2026-03-22
- Built Feature 3.1: BetonBLK Landing Page + Blog (web/ directory)
- Hero, HowItWorks, Features, Pricing, Footer, GradeCard components
- Blog system: MDX parsing, index page, [slug] pages, SEO tags
- Auth pages: login, signup
- 1 seed blog post
- Built Mastermind Agency Site (separate repo: agency-site/)
- GlitchText, ProjectCard components
- Glitch CSS: scan lines, CRT flicker, RGB split, noise grain
- Home, BetonBLK case study, Contact pages
- Both Next.js projects build clean
- Built Feature 3.1: Landing page + blog (Hero, Pricing, Blog/MDX, Auth pages)
- Built Mastermind Agency Site (glitch aesthetic, 5 pages)
- Built Features 3.2 + 3.3: Scan UI + Bet Tracker
- Built Feature 3.4: Stripe Integration (checkout, webhooks, portal, founder codes)
- ALL FEATURES COMPLETE
- Total: 237 tests (210 Node.js + 27 Python), all green