- Add billing module (app/api/billing.py) with 5 API endpoints:
- GET /api/v1/billing/checkout/{tier} — redirect to Stripe Payment Links
- GET /api/v1/billing/status — current org tier, limits, upgrade URLs
- GET /api/v1/billing/success — Stripe success callback
- GET /api/v1/billing/cancel — Stripe cancel callback
- POST /api/v1/billing/webhook — handles 5 Stripe event types
- Zero-code payment flow: uses pre-configured Stripe Payment Links
with client_reference_id (org ID) and prefilled_email params
- Webhook handler processes checkout.session.completed,
customer.subscription.updated/deleted, invoice events
- Stripe signature verification via stripe library (primary)
or manual HMAC-SHA256 (fallback)
- Tier determination from payment amount: =pro, 9=team
- 4 new config settings in app/config.py:
stripe_pro_checkout_url, stripe_team_checkout_url,
stripe_webhook_secret, stripe_api_key
- Added stripe>=5.0,<16.0 dependency
- 29 tests in tests/test_billing.py (all passing)
- Total: 98 tests passing (69 existing + 29 new)
34 lines
No EOL
799 B
Text
34 lines
No EOL
799 B
Text
# Indie Status Page Settings (copy to .env and fill in)
|
|
|
|
# App
|
|
APP_NAME=Indie Status Page
|
|
DATABASE_URL=sqlite+aiosqlite:///./data/statuspage.db
|
|
SECRET_KEY=change-me-to-a-random-string
|
|
ADMIN_API_KEY=change-me-to-a-secure-api-key
|
|
DEBUG=true
|
|
|
|
# Site
|
|
SITE_NAME=My SaaS Status
|
|
SITE_URL=http://localhost:8000
|
|
SITE_LOGO_URL=
|
|
SITE_ACCENT_COLOR=#4f46e5
|
|
|
|
# SMTP (optional - leave blank to disable email)
|
|
SMTP_HOST=
|
|
SMTP_PORT=587
|
|
SMTP_USER=
|
|
SMTP_PASS=
|
|
SMTP_FROM=noreply@example.com
|
|
|
|
# Webhook (optional - leave blank to disable)
|
|
WEBHOOK_NOTIFY_URL=
|
|
|
|
# Uptime Monitoring
|
|
MONITOR_CHECK_INTERVAL=60
|
|
|
|
# Stripe Checkout Links (set these in production)
|
|
# Create Payment Links in Stripe Dashboard → Products → Payment Links
|
|
STRIPE_PRO_CHECKOUT_URL=
|
|
STRIPE_TEAM_CHECKOUT_URL=
|
|
STRIPE_WEBHOOK_SECRET=
|
|
STRIPE_API_KEY= |