Laravel Cashier simplifies subscription and payment billing with Stripe: customers, subscriptions, trials, invoices and webhooks. Card data is entered on the Stripe Checkout page and never reaches your server.
Installation and test mode
Turn on Test mode in the Stripe Dashboard, take the test API keys and create a product and price (price_...). Test keys never move real money.
composer require laravel/cashier
php artisan vendor:publish --tag="cashier-migrations"
php artisan migrate
# .env
STRIPE_KEY=pk_test_xxx
STRIPE_SECRET=sk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx
CASHIER_CURRENCY=usd<?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Cashier\Billable;
class User extends Authenticatable
{
use Billable;
}| Test card | Result |
|---|---|
4242 4242 4242 4242 | Successful payment |
4000 0025 0000 3155 | Requires 3D Secure confirmation |
4000 0000 0000 9995 | Insufficient funds (declined) |
💡 Test cards accept any future date and any CVC.
Paying with Checkout
checkout() creates a session at Stripe and redirects the user to the payment page. On success success_url opens, on cancel cancel_url.