v2.1.0
v2.1.0
This release lets applications adjust Stripe Checkout Sessions without editing BillingService, and keeps npm run test inside the tests folder.
Added
- Added
BillingService::customizeStripeCheckoutSessionsUsing()to adjust every Stripe Checkout Session right before it is created, for example to add metadata. Register the callback once at boot in a service provider. It receives the session's parameters and what the checkout is for (user,mode,subscription,plan,prices, andmanaged_payments), and returns the parameters to send. It applies to standard subscription and one-time checkouts as well as Managed Payments, where the parameters also include the customer's ID when the user is known. Passingnullremoves the callback.
Changed
- Updated the reusable AI guidance on billing: applications customize Stripe Checkout Sessions through the new callback instead of editing
BillingService.
Fixed
npm run testnow limits Vitest to thetestsfolder. Vitest previously scanned the whole project and ran any test file whose path containedtests/, such as those of a project or release copied understorage/.
Dependencies
- Updated minor and patch Composer and npm dependencies.
Upgrade Guide
- Run
composer installandnpm cito install the locked dependency versions. - If you edited
BillingServiceto change Stripe Checkout Sessions, move those changes into acustomizeStripeCheckoutSessionsUsing()callback, so future updates ofBillingServicemerge cleanly. On standard Checkout, the parameters don't include thecustomeror the discount, which Laravel Cashier adds afterwards. - If you changed the
testscript inpackage.json, keep--dir testsor your own folder restriction when merging.