Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cashier Laravel Package

laravel/cashier

Laravel Cashier adds a fluent Stripe subscription billing layer to Laravel. Manage plans, trials, coupons, quantities, swaps, cancellations with grace periods, and invoicing, including PDF invoice generation, with minimal boilerplate.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

Laravel Cashier is a highly specialized package designed to abstract Stripe’s subscription billing logic into a Laravel-friendly, Eloquent-based interface. It aligns perfectly with:

  • Laravel-first architectures (Laravel 10+ compatibility, Eloquent models, Blade/Inertia integration).
  • Subscription-heavy SaaS products (recurring billing, trials, coupons, prorations, invoices).
  • Stripe-centric workflows (webhooks, payment methods, subscription management).

Key strengths:

  • Fluent API for subscription operations (e.g., user->newSubscription('default', $plan)->create($paymentMethod)).
  • Webhook handling (automated subscription lifecycle events via HandleWebhook middleware).
  • Invoice generation (PDFs via dompdf).
  • Multi-tenancy support (scopes subscriptions to users via Eloquent relationships).

Potential misfit:

  • Non-Stripe payment providers: Cashier is Stripe-exclusive (though Laravel Breeze/Paddle alternatives exist).
  • Complex custom billing logic: Heavy reliance on Stripe’s API may limit bespoke workflows (e.g., hybrid billing models).

Integration Feasibility

Prerequisites:

  1. Laravel 10+ (v16.x) or Laravel 9+ (v15.x) with PHP 8.1+ (PHP 8.5+ for v16.x).
  2. Stripe API keys (test/live) configured in .env.
  3. Database migrations for subscriptions, subscription_items, and invoices tables.
  4. Webhook endpoint (e.g., /stripe/webhooks) with VerifyWebhookSignature middleware.

Integration Path:

  1. Composer Install:
    composer require laravel/cashier stripe/stripe-php
    
  2. Publish Config/Migrations:
    php artisan vendor:publish --provider="Laravel\Cashier\CashierServiceProvider"
    php artisan migrate
    
  3. Configure Stripe Keys in .env:
    STRIPE_KEY=your_test_key
    STRIPE_SECRET=your_test_secret
    
  4. Set Up Webhooks (Stripe Dashboard → Developers → Webhooks → Add Endpoint).
  5. Extend User Model (trait HasSubscriptions):
    use Laravel\Cashier\Billable;
    class User extends Authenticatable {
        use Billable;
    }
    

Feasibility Score: 9/10 (minimal friction for Laravel apps; Stripe dependency is the only constraint).


Technical Risk

Risk Area Severity Mitigation
Stripe API Changes High Cashier abstracts most changes, but breaking updates (e.g., Stripe SDK v16+) require testing. Monitor Stripe API changelog.
Webhook Reliability Medium Use VerifyWebhookSignature middleware and test locally with Stripe CLI.
Tax/Invoice Complexity Medium Cashier handles most tax logic, but custom tax rules may need overrides.
Legacy Laravel Support Low Drop support for Laravel <9.x (v15.x) or <10.x (v16.x) if using newer versions.
Performance Low Webhooks and invoice generation are async-friendly; cache Stripe API responses if needed.

Critical Questions for TPM:

  1. Stripe Dependency: Is the team comfortable with Stripe’s pricing model and potential API changes?
  2. Webhook Testing: How will subscription lifecycle events (e.g., invoice.paid) be tested in CI?
  3. Custom Billing Logic: Are there workflows (e.g., usage-based billing) that Cashier doesn’t natively support?
  4. Multi-Region Support: Will subscriptions span multiple Stripe accounts (e.g., for compliance)?
  5. Downtime Risk: What’s the backup plan if Stripe’s API is unavailable?

Integration Approach

Stack Fit

Best For:

  • Laravel Monoliths: Tight integration with Eloquent, Blade, and Inertia.
  • SaaS Products: Recurring revenue models (e.g., subscriptions, trials, prorations).
  • Stripe-Centric Workflows: Leveraging Stripe’s Checkout, Billing, and Invoicing APIs.

Less Ideal For:

  • Microservices: Cashier assumes a single Laravel app; distributed billing would require custom logic.
  • Non-Stripe Providers: Paddle, FastSpring, or custom payment gateways would need a wrapper.
  • One-Time Payments: Focused on subscriptions; use stripe/stripe-php directly for OTPs.

Migration Path

Phase Tasks Tools/Dependencies
Pre-Migration Audit existing billing logic; identify Stripe API calls to replace. Postman (API testing), Laravel Telescope (logs).
Setup Install Cashier, publish config/migrations, configure Stripe keys. Composer, Artisan.
Core Integration Extend User model, set up webhooks, test subscription flows. Stripe CLI, Laravel Dusk.
Feature Parity Replace custom billing logic with Cashier methods (e.g., createSubscription()). Changelog review, feature flags.
Webhook Validation Test all Stripe events locally; deploy with monitoring. Stripe CLI, Sentry.
Go-Live Enable Stripe webhooks, monitor for failures, roll back if needed. Feature flags, canary releases.

Sequencing:

  1. MVP: Subscriptions + Checkout (minimal viable billing).
  2. Phase 2: Invoices, coupons, and webhook-driven workflows.
  3. Phase 3: Advanced features (usage-based billing, tax adjustments).

Compatibility

Component Compatibility Notes
Laravel 10.x (v16.x), 9.x (v15.x), 8.x (v14.x) Drop older versions if using latest Cashier.
PHP 8.1+ (v15.x), 8.5+ (v16.x) Align with Laravel’s PHP requirements.
Stripe SDK v16+ (v16.x Cashier) Breaking changes may require updates.
Database MySQL, PostgreSQL, SQLite (with caveats) SQLite may need adjustments for migrations.
Frontend Blade, Inertia, Livewire (Checkout integration) Use Checkout::newSession() for embedded forms.
Third-Party dompdf (invoices), Guzzle (HTTP), Symfony (components) Dependencies are well-maintained.

Key Compatibility Risks:

  • Stripe API Version Mismatch: Ensure Cashier’s Stripe SDK version matches your Stripe account’s API version.
  • Legacy Code: Custom billing logic may conflict with Cashier’s methods (e.g., createAsStripeCustomer()).

Operational Impact

Maintenance

Pros:

  • Minimal Boilerplate: Cashier handles 80% of subscription logic (e.g., prorations, trials, invoices).
  • Active Development: Regular updates for Stripe API changes (e.g., v16.x supports PHP 8.5).
  • Community Support: 2.5K+ stars, Laravel ecosystem backing.

Cons:

  • Stripe Lock-in: Migrating to another provider would require rewriting billing logic.
  • Dependency Bloat: Cashier pulls in Stripe SDK (~10MB) and Symfony components.

Maintenance Tasks:

  • Monthly: Test webhooks with Stripe CLI; update Cashier if Stripe API changes.
  • Quarterly: Review Stripe’s deprecation policy.
  • Annual: Audit custom overrides for Cashier methods.

Support

Support Channels:

  • Laravel Docs: laravel.com/docs/billing.
  • GitHub Issues: 1.8K+ open/closed issues (response time varies).
  • Stripe Support: For Stripe-specific issues (e.g., webhook failures).

Common Support Needs:

  1. Webhook Debugging: Use stripe listen --forward-to localhost:3000/stripe/webhooks for local testing.
  2. **Tax/
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai