Immediate Priority (Required for Production)
Create Stripe Webhook Handler
PHP
// app/Http/Controllers/StripeWebhookController.php
- Handle: customer.subscription.updated
- Handle: customer.subscription.deleted
- Handle: invoice.payment_failed
- Handle: invoice.payment_succeeded
Add Comprehensive Tests
PHP
// tests/Feature/SubscriptionTest.php
- Test trial subscription creation
- Test paid subscription creation
- Test subscription cancellation
- Test subscription resumption
- Test webhook events
Create Filament Pages
PHP
// app/Filament/App/Pages/SubscriptionPage.php
- Display current subscription status
- Show upgrade/downgrade options
- Manage payment methods
- View billing history
Add Route/Config for Webhooks
Register webhook route in routes/web.php
Set webhook secret in environment
Configure Stripe webhook URL
Secondary Priority (Enhanced UX)
Payment Method Management
Add/remove payment methods
Set default payment method
Update expiring cards
Subscription Lifecycle
Graceful downgrade flow
Subscription pause option
Usage-based billing support
Error Handling
Retry failed payments
Customer notifications for failed payments
Dunning management
Testing Checklist
Code
□ Trial subscription without payment method
□ Trial subscription with payment method
□ Trial expiration without payment
□ Trial conversion to paid
□ Successful payment processing
□ Failed payment handling
□ Subscription cancellation flows
□ Webhook event processing
□ Stripe API error handling
□ Premium features access control
□ DNA upload limits enforcement
Environment Variables Required
env
STRIPE_KEY=pk_test_...
STRIPE_SECRET=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
SUBSCRIPTION_PREMIUM_STRIPE_PRICE_ID=price_...
SUBSCRIPTION_PREMIUM_PRICE=$2.99
SUBSCRIPTION_PREMIUM_INTERVAL=month
SUBSCRIPTION_PREMIUM_TRIAL_DAYS=14
PREMIUM_ENABLED=true
Immediate Priority (Required for Production)
Create Stripe Webhook Handler
PHP
// app/Http/Controllers/StripeWebhookController.php
Add Comprehensive Tests
PHP
// tests/Feature/SubscriptionTest.php
Create Filament Pages
PHP
// app/Filament/App/Pages/SubscriptionPage.php
Add Route/Config for Webhooks
Register webhook route in routes/web.php
Set webhook secret in environment
Configure Stripe webhook URL
Secondary Priority (Enhanced UX)
Payment Method Management
Add/remove payment methods
Set default payment method
Update expiring cards
Subscription Lifecycle
Graceful downgrade flow
Subscription pause option
Usage-based billing support
Error Handling
Retry failed payments
Customer notifications for failed payments
Dunning management
Testing Checklist
Code
□ Trial subscription without payment method
□ Trial subscription with payment method
□ Trial expiration without payment
□ Trial conversion to paid
□ Successful payment processing
□ Failed payment handling
□ Subscription cancellation flows
□ Webhook event processing
□ Stripe API error handling
□ Premium features access control
□ DNA upload limits enforcement
Environment Variables Required
env
STRIPE_KEY=pk_test_...
STRIPE_SECRET=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
SUBSCRIPTION_PREMIUM_STRIPE_PRICE_ID=price_...
SUBSCRIPTION_PREMIUM_PRICE=$2.99
SUBSCRIPTION_PREMIUM_INTERVAL=month
SUBSCRIPTION_PREMIUM_TRIAL_DAYS=14
PREMIUM_ENABLED=true