diff options
Diffstat (limited to 'Biz/PodcastItLater/STRIPE_TESTING.md')
| -rw-r--r-- | Biz/PodcastItLater/STRIPE_TESTING.md | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/Biz/PodcastItLater/STRIPE_TESTING.md b/Biz/PodcastItLater/STRIPE_TESTING.md index 00910ec..63cfdf6 100644 --- a/Biz/PodcastItLater/STRIPE_TESTING.md +++ b/Biz/PodcastItLater/STRIPE_TESTING.md @@ -315,15 +315,72 @@ Full list: https://stripe.com/docs/testing#cards ## Production Deployment -Before going to production: - -1. Switch to live mode keys (remove `_test_` from keys) -2. Create products/prices in live mode Stripe dashboard -3. Set up live webhook endpoint in Stripe dashboard -4. Update STRIPE_WEBHOOK_SECRET to live mode secret -5. Set AREA=Live in production environment -6. Test with real payment methods (or use test mode in production at first) -7. Monitor webhook events and logs closely +### Prerequisites + +1. **Stripe Live Mode Setup:** + - Create products/prices in live mode Stripe dashboard + - Get live mode API keys (sk_live_...) + - Set up webhook endpoint at: `https://podcastitlater.bensima.com/stripe/webhook` + - Configure webhook events: checkout.session.completed, customer.subscription.*, invoice.payment_failed + - Copy webhook signing secret (whsec_...) + +2. **Environment Variables:** + Create `/run/podcastitlater/env` on production server with: + ```bash + # Authentication + SECRET_KEY=<generate-with-openssl-rand-hex-32> + SESSION_SECRET=<generate-with-openssl-rand-hex-32> + + # Email (for magic links) + EMAIL_FROM=noreply@podcastitlater.bensima.com + SMTP_SERVER=smtp.mailgun.org + SMTP_PASSWORD=<mailgun-smtp-password> + + # Stripe (use test mode first, then switch to live) + STRIPE_SECRET_KEY=sk_test_... # or sk_live_... + STRIPE_WEBHOOK_SECRET=whsec_... + STRIPE_PRICE_ID_PERSONAL=price_... + STRIPE_PRICE_ID_PRO=price_... + ``` + +3. **Build and Deploy:** + ```bash + # On development machine, build the service + bild --time 0 Biz/PodcastItLater/Web.py + + # Deploy to production server (method depends on your deployment setup) + # The Web.nix service configuration handles: + # - HTTPS via nginx with automatic SSL (Let's Encrypt) + # - BASE_URL set to https://podcastitlater.bensima.com + # - AREA=Live for production mode + # - Data directory at /var/podcastitlater + ``` + +### Deployment Steps + +1. **Start with Test Mode:** + - Use `STRIPE_SECRET_KEY=sk_test_...` initially + - Test the full flow with test cards + - Verify webhooks are received and processed + +2. **Switch to Live Mode:** + - Update environment variables to use `sk_live_...` + - Update price IDs to live mode prices + - Update webhook secret to live mode webhook + - Restart service + +3. **Verify Deployment:** + - Visit https://podcastitlater.bensima.com + - Test login flow + - Check billing page loads + - Try checkout flow (cancel before paying if testing) + - Monitor logs for errors + +4. **Monitor Production:** + - Check webhook events in database + - Monitor subscription states + - Watch for payment failures + - Set up alerts for critical errors ## Monitoring |
