Laravel Cashier is a subscription billing library for Laravel applications that integrates seamlessly with Stripe or Paddle. It simplifies handling subscription logic, such as billing, payments, and invoices, in SaaS applications.
Cashier was introduced to reduce the complexity of integrating billing systems into Laravel applications, leveraging popular payment gateways like Stripe and Paddle.
Install Cashier:
composer require laravel/cashier
Set up the Billable
trait in your User
model:
namespace App\Models;
use Laravel\Cashier\Billable;
class User extends Authenticatable
{
use Billable;
}
Create a new subscription:
$user = User::find(1);
$user->newSubscription('default', 'price_id')->create($paymentMethod);
Handle Stripe webhooks:
php artisan cashier:webhook
Cashier streamlines subscription billing, making it easier to build and manage SaaS applications.