| Age | Commit message (Collapse) | Author |
|
- Handle case where client_reference_id is None or missing - Fall back
to checking metadata.user_id if client_reference_id not available -
Add try/except for int() conversion with proper error logging - Use
safe .get() for session ID in error messages - Prevents TypeError:
int() argument must be a string when webhook has None value
|
|
- Skip signature verification if STRIPE_WEBHOOK_SECRET is not set -
Add warning log when verification is skipped - Parse webhook payload
as JSON directly in test mode - Enables local testing with 'stripe
trigger' without configuring webhook secret - Production still requires
proper webhook secret for security
|
|
- Add TestWebhookHandling class with tests for subscription webhooks -
Test normal subscription creation flow with mock data - Test handling
of incomplete webhook data (missing fields) - Add STRIPE_TESTING.md
with comprehensive testing guide:
- How to use Stripe test mode and test cards - How to use Stripe
CLI to trigger test webhooks - Instructions for running unit tests -
Database migration instructions for production - End-to-end testing
workflow - Common troubleshooting issues
Tests verify webhook handling works without calling real Stripe API.
|
|
- Replace direct dict key access with .get() for all subscription
fields - Add validation and early return for missing required fields -
Add logging warnings when subscription data is incomplete - Handles
both dict and Stripe object access patterns safely - Fixes KeyError:
'current_period_start' when processing webhooks
|
|
Simplified pricing to two tiers: - Free: 10 articles total (lifetime)
- Pro: $29/month unlimited articles
Removed STRIPE_PRICE_ID_PERSONAL from configuration.
|
|
Free tier now has 10 articles total (lifetime) instead of 10 per month.
Period boundaries for free users now span from account creation to
far future.
|
|
- Add stripe to Omni/Bild/Deps/Python.nix (alphabetically sorted) -
Fix all type annotations in Billing.py for mypy - Document how to add
Python packages in AGENTS.md - Add billing routes to Web.py (checkout,
portal, webhook)
This enables Stripe integration in PodcastItLater.
Related to task t-144e7lF
|
|
Add complete Stripe integration backend ready for testing once stripe
package is available in Nix environment.
Components: - Billing.py: Stripe Checkout, Billing Portal, webhook
handling - Database migrations for subscription tracking - Usage
tracking with tier-based limits - Idempotent webhook processing with
stripe_events table
Tier limits: free (10/mo), personal (50/mo), pro (unlimited)
Webhook events handled: - checkout.session.completed (link customer to
user) - customer.subscription.{created,updated,deleted} (sync state)
- invoice.payment_failed (mark past_due)
Requires: Stripe Python package in Nix, Web.py routes (next commit)
Related to task t-144e7lF
Amp-Thread-ID:
https://ampcode.com/threads/T-8feaca83-dcc2-46cb-8f71-d0785960a2f7
Co-authored-by: Amp <amp@ampcode.com>
|