- What is Laravel Cashier used for?
- Laravel Cashier provides an expressive, fluent interface to Stripe subscription billing for Laravel applications. It handles common boilerplate such as coupons, subscription swapping, quantities, cancellation grace periods, and invoice PDF generation. It is best suited to Laravel apps that have already chosen Stripe as their billing provider.
- How do I install Laravel Cashier?
- Install the package with Composer, publish and run its migrations, and add the Billable trait to your customer model. You then configure your Stripe keys and expose a signed Stripe webhook endpoint. The official Laravel billing documentation covers the required setup steps and configuration details.
- How do I configure Laravel Cashier with Stripe keys?
- Configure your Stripe API keys and webhook secret in the Laravel application environment and services configuration. Cashier uses those credentials to communicate with Stripe and to verify signed webhook requests. Keep secret keys out of source control and use separate test and production credentials.
- Does Laravel Cashier support Laravel 12 and PHP 8.4?
- Recent Cashier releases indicate support for Laravel 12 and PHP 8.4, along with Stripe PHP SDK v16, Carbon 3, and dompdf 3.0. You should still confirm the exact package major version against your application's Laravel, PHP, and dependency constraints before upgrading. Pinning a known-good major version reduces compatibility risk.
- How does Laravel Cashier handle webhooks and subscription state?
- Cashier exposes a signed Stripe webhook endpoint and uses Stripe events to keep local subscription and invoice state in sync. Webhook correctness is critical because missed, duplicated, or out-of-order events can cause subscription state drift. Use a reliable public endpoint, idempotency handling, queueing where appropriate, and reconciliation checks.
- Can Laravel Cashier handle coupons, trials, and subscription swapping?
- Yes. Cashier supports coupons, subscription swapping, subscription quantities, cancellation grace periods, and invoice PDF generation. Trials and other Stripe billing behaviors still require correct product and price modeling in Stripe. Cashier accelerates the lifecycle code but does not replace billing-domain decisions.
- How do I test Laravel Cashier billing flows?
- Test with Stripe test API keys and exercise your signed webhook endpoint with representative Stripe events. Add regression tests around subscription creation, swapping, cancellation, invoices, and webhook idempotency. Because webhook state drift is a key risk, include reconciliation tests rather than testing only happy-path API calls.
- Is Laravel Cashier suitable for multi-gateway or non-Stripe billing?
- Laravel Cashier is tightly coupled to Stripe and is a poor fit if the product requires multi-gateway billing or an abstraction layer that hides the billing provider. It is an accelerator for Stripe subscription billing, not a complete multi-processor billing platform. If multi-gateway support is a hard requirement, preserve an internal abstraction or evaluate another approach.
- What are some alternatives to Laravel Cashier for subscription billing?
- If you use Paddle, Laravel Cashier Paddle is a separate official package rather than the Stripe variant. Directly integrating the Stripe PHP SDK or building a custom billing layer may fit teams that need more control or multi-gateway flexibility. The right choice depends on whether Stripe is definitively the billing system of record.
- How do I maintain and upgrade Laravel Cashier in production?
- Pin Cashier to a known-good major version and pair it with a deliberate Stripe API version. Track the changelog, run regression tests for webhooks and subscription lifecycle changes, and maintain reconciliation for billing state. Your team should own upgrades, security patches, Stripe API-version changes, and production billing support.