diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-13 11:19:31 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-13 11:20:19 -0500 |
| commit | 2cffd4d04becce6b23ee6cb954bb4db56ce340e4 (patch) | |
| tree | 36627a98987e9f863ac6deee04a9bbc39731146b | |
| parent | f1e893ef05b20059a1850bb0fef9103e10d9af20 (diff) | |
Switch to just one paid plan
I don't need the complexity of multiple plans, just one for now
to test.
| -rw-r--r-- | Biz/PodcastItLater/Billing.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Biz/PodcastItLater/Billing.py b/Biz/PodcastItLater/Billing.py index 7746f79..41d04d6 100644 --- a/Biz/PodcastItLater/Billing.py +++ b/Biz/PodcastItLater/Billing.py @@ -29,11 +29,11 @@ stripe.api_key = os.getenv("STRIPE_SECRET_KEY", "") STRIPE_WEBHOOK_SECRET = os.getenv("STRIPE_WEBHOOK_SECRET", "") # Price IDs from Stripe dashboard -STRIPE_PRICE_ID_PRO = os.getenv("STRIPE_PRICE_ID_PRO", "") +STRIPE_PRICE_ID_PAID = os.getenv("STRIPE_PRICE_ID_PAID", "") # Map Stripe price IDs to tier names PRICE_TO_TIER = { - STRIPE_PRICE_ID_PRO: "pro", + STRIPE_PRICE_ID_PAID: "paid", } # Tier limits (None = unlimited) @@ -42,7 +42,7 @@ TIER_LIMITS = { "articles_per_period": 10, "minutes_per_period": None, }, - "pro": { + "paid": { "articles_per_period": None, "minutes_per_period": None, }, @@ -50,7 +50,7 @@ TIER_LIMITS = { # Price map for checkout PRICE_MAP = { - "pro": STRIPE_PRICE_ID_PRO, + "paid": STRIPE_PRICE_ID_PAID, } @@ -138,7 +138,7 @@ def create_checkout_session(user_id: int, tier: str, base_url: str) -> str: Args: user_id: User ID - tier: Subscription tier (pro) + tier: Subscription tier (paid) base_url: Base URL for success/cancel redirects Returns: @@ -454,10 +454,10 @@ def get_tier_info(tier: str) -> dict[str, typing.Any]: "price": "$0", "description": "10 articles total", }, - "pro": { - "name": "Pro", + "paid": { + "name": "Paid", "articles_limit": None, - "price": "$29/mo", + "price": "$12/mo", "description": "Unlimited articles", }, } @@ -487,7 +487,7 @@ class TestWebhookHandling(Test.TestCase): # Temporarily set price mapping for test global PRICE_TO_TIER old_mapping = PRICE_TO_TIER.copy() - PRICE_TO_TIER["price_test_pro"] = "pro" + PRICE_TO_TIER["price_test_paid"] = "paid" try: # Step 1: Handle checkout.session.completed @@ -495,7 +495,7 @@ class TestWebhookHandling(Test.TestCase): "id": "cs_test123", "client_reference_id": str(user_id), "customer": "cus_test123", - "metadata": {"user_id": str(user_id), "tier": "pro"}, + "metadata": {"user_id": str(user_id), "tier": "paid"}, } _handle_checkout_completed(checkout_session) @@ -517,7 +517,7 @@ class TestWebhookHandling(Test.TestCase): "data": [ { "price": { - "id": "price_test_pro", + "id": "price_test_paid", }, }, ], @@ -529,7 +529,7 @@ class TestWebhookHandling(Test.TestCase): user = Core.Database.get_user_by_id(user_id) self.assertIsNotNone(user) assert user is not None - self.assertEqual(user["plan_tier"], "pro") + self.assertEqual(user["plan_tier"], "paid") self.assertEqual(user["subscription_status"], "active") self.assertEqual(user["stripe_subscription_id"], "sub_test123") self.assertEqual(user["stripe_customer_id"], "cus_test123") |
