laravel-billing
Integrate Stripe and Paddle payments with Laravel Cashier. Use when implementing subscriptions, invoices, payment methods, or billing portals.
When & Why to Use This Skill
This Claude skill facilitates the seamless integration of Stripe and Paddle payment systems into Laravel applications via Laravel Cashier. It provides comprehensive support for managing recurring subscriptions, one-time payments, automated invoicing, and secure billing portals, significantly reducing the development overhead for SaaS financial infrastructure and ensuring PCI-compliant payment handling.
Use Cases
- SaaS Subscription Management: Implementing multi-tier subscription plans (monthly/yearly) with automated handling of trials, upgrades, and cancellations.
- Self-Service Billing Portals: Generating secure links for users to manage their payment methods, view billing history, and download PDF invoices directly.
- Webhook Synchronization: Processing asynchronous events from Stripe or Paddle, such as successful payment notifications or failed renewal alerts, to keep application data in sync.
- One-time Transactions: Handling individual charges for digital goods or services and managing refund logic within the Laravel ecosystem.
| name | laravel-billing |
|---|---|
| description | Integrate Stripe and Paddle payments with Laravel Cashier. Use when implementing subscriptions, invoices, payment methods, or billing portals. |
Laravel Billing (Cashier)
Documentation
Billing
- billing.md - Stripe Cashier
- cashier-paddle.md - Paddle Cashier
Stripe Setup
// Install
composer require laravel/cashier
// User model
use Laravel\Cashier\Billable;
class User extends Authenticatable
{
use Billable;
}
Subscription Controller
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
final class SubscriptionController extends Controller
{
public function store(Request $request)
{
$request->user()
->newSubscription('default', 'price_monthly')
->create($request->paymentMethodId);
return redirect()->route('dashboard');
}
public function cancel(Request $request)
{
$request->user()->subscription('default')->cancel();
return back();
}
public function resume(Request $request)
{
$request->user()->subscription('default')->resume();
return back();
}
}
Check Subscription Status
if ($user->subscribed('default')) {
// Has active subscription
}
if ($user->subscribedToPrice('price_monthly', 'default')) {
// On monthly plan
}
if ($user->onTrial('default')) {
// Currently on trial
}
if ($user->subscription('default')->cancelled()) {
// Subscription cancelled
}
if ($user->subscription('default')->onGracePeriod()) {
// Still has access after cancellation
}
Single Charges
$user->charge(1000, $paymentMethodId);
$user->invoiceFor('Product Name', 1500);
$user->refund($paymentIntentId);
Billing Portal
Route::get('/billing', function (Request $request) {
return $request->user()->redirectToBillingPortal(route('dashboard'));
})->middleware('auth');
Webhooks
Route::post('/stripe/webhook', [WebhookController::class, 'handleWebhook']);
class WebhookController extends CashierController
{
public function handleInvoicePaymentSucceeded($payload)
{
// Handle successful payment
}
}