Add Stripe subscriptions and one-time charges to your app with Laravel Cashier.
Laravel Cashier — Stripe Billing
composer require laravel/cashier
php artisan vendor:publish --tag="cashier-migrations"
php artisan migrate
// Model
class User extends Authenticatable {
use Billable;
}
// Subscribe
$user->newSubscription("default", "price_monthly")
->create($paymentMethod);
// Check subscription
$user->subscribed("default");
$user->subscribedToPrice("price_monthly");
$user->onTrial();
// Change plan
$user->subscription("default")->swap("price_yearly");
// Cancel
$user->subscription("default")->cancel(); // end of period
$user->subscription("default")->cancelNow(); // immediate
// One-time charge
$user->charge(1000, $paymentMethod); // amount in cents