diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-13 16:03:16 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-13 16:03:16 -0500 |
| commit | 44d6ace4961b167ce9503f3f5a7299a37f3dc8de (patch) | |
| tree | abe1c832a0240f317c697617365b4b1f9e5c0a9a /Biz/PodcastItLater/Billing.py | |
| parent | 1ad2f8b234bcf227605f285450a41f40a0e0e3a7 (diff) | |
Simplify Stripe portal error handling and fix account page padding
- Remove user-facing error messages for portal configuration -
Just log the error server-side and return 500 status - Use Bootstrap
card-header class for proper padding on section headers - This fixes
icons touching the card borders
Portal errors will now be logged but won't break the UI.
Amp-Thread-ID:
https://ampcode.com/threads/T-8edacbeb-b343-49ca-b524-1c999272acb6
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Biz/PodcastItLater/Billing.py')
| -rw-r--r-- | Biz/PodcastItLater/Billing.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/Biz/PodcastItLater/Billing.py b/Biz/PodcastItLater/Billing.py index bf907bf..9f3739d 100644 --- a/Biz/PodcastItLater/Billing.py +++ b/Biz/PodcastItLater/Billing.py @@ -212,19 +212,10 @@ def create_portal_session(user_id: int, base_url: str) -> str: msg = "User has no Stripe customer ID" raise ValueError(msg) - try: - session = stripe.billing_portal.Session.create( - customer=user["stripe_customer_id"], - return_url=f"{base_url}/account", - ) - except Exception as e: - # Catch Stripe errors (portal not configured, etc.) - logger.exception("Stripe portal error") - msg = ( - "Billing portal not configured. " - "Please contact support or cancel via your account page." - ) - raise ValueError(msg) from e + session = stripe.billing_portal.Session.create( + customer=user["stripe_customer_id"], + return_url=f"{base_url}/account", + ) logger.info( "Created portal session for user %s: %s", |
