-
Notifications
You must be signed in to change notification settings - Fork 721
[16.x] Flexible Billing Support for Laravel Cashier #1772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 16.x
Are you sure you want to change the base?
Conversation
- Introduced 'default_billing_mode' configuration in cashier.php to set the default billing mode for new subscriptions. - Added new migration files for 'subscription_schedules' and 'quotes' tables. - Implemented billing mode management in Subscription, Quote, and their respective builders. - Enhanced CheckoutBuilder to handle billing mode during subscription creation. - Added tests for flexible billing mode functionality in subscriptions and quotes. This update requires Stripe API version 2025-06-30.basil or later for flexible billing features.
- Standardized spacing and formatting in various classes, including CheckoutBuilder, Quote, Subscription, and others. - Removed unnecessary blank lines and ensured consistent use of whitespace. - Added missing newlines at the end of several files to comply with coding standards. - Improved readability and maintainability of the codebase. This commit does not introduce any new features or changes to functionality.
…files - Improved code style by removing unnecessary blank lines and ensuring consistent whitespace usage. - Added missing newlines at the end of several files to comply with coding standards. - Enhanced readability and maintainability of the codebase without introducing new features or functionality.
|
I honestly don't know if I have the appetite for this right now seeing how much code we would be committing to maintaining forever. I will table this for sometime after 16.x release. |
|
I've started using flexible mode together with Cashier for a usage based subscription. One of the things that should be fixed here is that, currently, when removing or swapping a metered price, Cashier sets
We need to check whether You know, in case this MR ever plans to get merged. |
|
Thank you a lot @Diddyy for sharing this PR! |
This PR introduces comprehensive Flexible Billing support to Laravel Cashier, enabling modern usage-based billing models, billing credits, and advanced subscription management that aligns with Stripe's latest Basil API capabilities.
What is Flexible Billing?
Flexible Billing represents the future of subscription commerce, moving beyond traditional fixed-price subscriptions to support:
Flexible Billing Features
1. Usage-Based Billing (
ManagesUsageBillingtrait)2. Billing Credits Management (
ManagesBillingCreditstrait)3. Advanced Subscription Scheduling for Flexible Billing
4. Real-World Flexible Billing Use Cases
This implementation enables modern SaaS pricing models:
Flexible Billing Infrastructure
Enhanced Database Schema for Usage Billing
meter_idandmeter_event_namecolumns tosubscription_itemstablemetadataJSON column tosubscription_schedulestableStripe API Modernization
flexiblevsclassicbilling modesAdvanced Subscription Management
Testing
Breaking Changes
Minor Breaking Changes
Migration to Flexible Billing
Enable Flexible Billing Features
Implement Usage-Based Pricing
Create Flexible Subscriptions
Documentation Updates Needed
Key achievements:
This enables Laravel applications to compete with modern SaaS pricing models and unlock new revenue opportunities through flexible, usage-based billing.
/cc @taylorotwell @driesvints @crynobone