summaryrefslogtreecommitdiff
path: root/Biz/PodcastItLater/Web.py
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-12 14:57:21 -0500
committerBen Sima <ben@bsima.me>2025-11-12 14:57:21 -0500
commit2e3d0626341291dd71a92ed58815616d4e276dca (patch)
tree34081302183e3097a1dd5ae27f8198a8f94e5f9e /Biz/PodcastItLater/Web.py
parent92ddb4f3407e34fe8eb4b53abfdbc77f75a24bfe (diff)
Add complete Stripe billing integration to PodcastItLater
- Implement Biz.PodcastItLater.Billing with checkout sessions, billing portal, webhook handling - Add subscription database schema: plan_tier, stripe fields, period dates, stripe_events table - Three-tier pricing: free (10/month), personal (/month, 50 articles), pro (9/month, unlimited) - Usage tracking and enforcement with tier-based limits - Full billing UI with plan display, usage stats, pricing cards, upgrade buttons - Dashboard shows current tier with billing button - Update Web.nix with Stripe environment variables - Fix POST redirects to Stripe with 303 status code for CloudFront compatibility Amp-Thread-ID: https://ampcode.com/threads/T-c139e5b5-1901-4cd6-8030-5623bfe1df35 Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Biz/PodcastItLater/Web.py')
-rw-r--r--Biz/PodcastItLater/Web.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Biz/PodcastItLater/Web.py b/Biz/PodcastItLater/Web.py
index b5d41dd..6d3cf0a 100644
--- a/Biz/PodcastItLater/Web.py
+++ b/Biz/PodcastItLater/Web.py
@@ -1568,7 +1568,7 @@ def billing_checkout(request: Request, data: FormData) -> Response:
try:
checkout_url = Billing.create_checkout_session(user_id, tier, BASE_URL)
- return RedirectResponse(url=checkout_url)
+ return RedirectResponse(url=checkout_url, status_code=303)
except ValueError as e:
logger.exception("Checkout error")
return Response(f"Error: {e!s}", status_code=400)
@@ -1583,7 +1583,7 @@ def billing_portal(request: Request) -> Response:
try:
portal_url = Billing.create_portal_session(user_id, BASE_URL)
- return RedirectResponse(url=portal_url)
+ return RedirectResponse(url=portal_url, status_code=303)
except ValueError as e:
logger.exception("Portal error")
return Response(f"Error: {e!s}", status_code=400)