cleaned up stripe config

This commit is contained in:
Corey Blais
2026-04-30 21:54:13 -04:00
parent 646f895ed6
commit cd7c4383d0
9 changed files with 384 additions and 73 deletions
+24 -2
View File
@@ -24,7 +24,6 @@ FlockPal is a Dockerized TypeScript app for tracking flock health with a clean,
- Medication and care reminders
- Invitation acceptance and onboarding polish for flock members
- Stripe or equivalent billing integration for paid household tiers
- Scheduled reminder delivery for birthdays, gotcha days, and care events
- Audit logging for flock access changes and bird transfers
@@ -111,9 +110,32 @@ Set these when the Stripe Checkout, Customer Portal, and webhook flow is enabled
- `STRIPE_CHECKOUT_CANCEL_URL`
- `STRIPE_PORTAL_RETURN_URL`
Recommended defaults:
- `STRIPE_CHECKOUT_SUCCESS_URL=https://your-frontend-host/?billing=success`
- `STRIPE_CHECKOUT_CANCEL_URL=https://your-frontend-host/?billing=cancelled`
- `STRIPE_PORTAL_RETURN_URL=https://your-frontend-host/?billing=portal`
## Stripe operations
- Configure the Stripe Customer Portal to allow subscription plan changes for the household products.
- Enable the proration behavior you want in the Customer Portal configuration. FlockPal treats Stripe as the source of truth for upgrade timing and proration outcomes.
- Point the Stripe webhook endpoint at `https://your-backend-host/api/billing/stripe/webhook`.
- Subscribe the webhook endpoint to at least `checkout.session.completed`, `customer.subscription.created`, `customer.subscription.updated`, and `customer.subscription.deleted`.
- Use one Stripe Price per plan and billing interval. FlockPal maps Stripe price IDs back to `household_basic`, `household_plus`, and `household_macaw`.
- After Stripe redirects back to the app, FlockPal now performs a direct billing sync against Stripe and then refreshes the active session. Webhooks are still required so asynchronous subscription changes stay in sync later.
For local development with the Stripe CLI:
```bash
stripe listen --forward-to http://localhost:5000/api/billing/stripe/webhook
```
Copy the signing secret printed by `stripe listen` into `STRIPE_WEBHOOK_SECRET`.
## Notes for monetization and security
This starter now includes the account and flock foundation for monetization, but it still needs production-grade session hardening, invitation verification, Stripe checkout/customer portal/webhook flows, audit logging, and background reminder delivery before launch.
This starter now includes the account and flock foundation for monetization, plus Stripe checkout, Customer Portal, and webhook synchronization. It still needs production-grade session hardening, invitation verification, audit logging, and background reminder delivery before launch.
Stripe billing should be attached to `workspaces`, not `users`. Each flock has its own billing plan, subscription status, Stripe customer ID, and Stripe subscription ID, which lets one person own multiple household flocks with separate subscriptions while rescue flocks can stay on the free rescue path.