taste-check
Review code using Linus Torvalds' "good taste" philosophy. Eliminates defensive code, special cases, and deep nesting. Use when reviewing code quality, refactoring, or checking for code smells.
laravel-cashier-paddle
Laravel Cashier (Paddle) - Subscription billing and payment processing
Full skill instructions
Comprehensive assistance with Laravel Cashier Paddle - an expressive, fluent interface to Paddle's subscription billing services for Laravel applications.
This skill should be triggered when:
use Laravel\Paddle\Billable;
class User extends Authenticatable
{
use Billable;
public function paddleName(): string|null
{
return $this->name;
}
public function paddleEmail(): string|null
{
return $this->email;
}
}
// Create checkout session
$checkout = $user->checkout('pri_deluxe_album')
->returnTo(route('dashboard'));
// Display checkout button
<x-paddle-button :checkout="$checkout" class="px-8 py-4">
Subscribe
</x-paddle-button>
// Single subscription
$checkout = $user->subscribe('price_basic_monthly', 'default')
->returnTo(route('home'));
// Multi-product subscription
$checkout = $user->subscribe([
'price_monthly',
'price_chat' => 5 // with quantity
]);
use Laravel\Paddle\Cashier;
// Preview prices for country
$prices = Cashier::previewPrices(['pri_123', 'pri_456'], [
'address' => ['country_code' => 'BE', 'postal_code' => '1234']
]);
// Display in Blade
@foreach ($prices as $price)
<li>{{ $price->product['name'] }} - {{ $price->total() }}</li>
<li>Subtotal: {{ $price->subtotal() }} + Tax: {{ $price->tax() }}</li>
@endforeach
// Check various subscription states
if ($user->subscribed()) { }
if ($user->subscribed('default')) { }
if ($user->subscribedToProduct('pro_basic')) { }
if ($user->subscription()->onTrial()) { }
if ($user->subscription()->onGracePeriod()) { }
if ($user->subscription()->canceled()) { }
if ($user->subscription()->pastDue()) { }
// Immediate swap with proration
$user->subscription()->swap('pri_456');
// Swap and invoice immediately
$user->subscription()->swapAndInvoice('pri_456');
// Swap without proration
$user->subscription()->noProrate()->swap('pri_456');
// Increment/decrement quantity
$user->subscription()->incrementQuantity();
$user->subscription()->incrementQuantity(5);
$user->subscription()->decrementQuantity();
// Set specific quantity
$user->subscription()->updateQuantity(10);
// Multi-product quantity
$user->subscription()->incrementQuantity(1, 'price_chat');
// Pause at period end
$user->subscription()->pause();
// Pause immediately
$user->subscription()->pauseNow();
// Pause until specific date
$user->subscription()->pauseUntil(now()->addMonth());
// Resume paused subscription
$user->subscription()->resume();
use Laravel\Paddle\Events\WebhookReceived;
use Laravel\Paddle\Events\TransactionCompleted;
// Listen for specific events
Event::listen(TransactionCompleted::class, function ($event) {
$transaction = $event->transaction;
// Process completed transaction
});
// Handle custom webhook events
public function handle(WebhookReceived $event): void
{
if ($event->payload['event_type'] === 'transaction.billed') {
// Handle custom event
}
}
// Retrieve transactions
$transactions = $user->transactions;
// Refund with specific items
$response = $transaction->refund('Accidental charge', [
'pri_123',
'pri_456' => 200 // partial refund amount
]);
// Full refund
$response = $transaction->refund('Customer request');
// Download invoice PDF
return $transaction->redirectToInvoicePdf();
Cashier Paddle uses checkout sessions to initiate payments. Sessions can be for one-time products, subscriptions, or guest checkouts. They support both overlay and inline display modes.
Any Eloquent model can become "billable" by using the Billable trait. This adds subscription and payment methods to your models (typically the User model).
Subscriptions represent recurring billing arrangements. They can have multiple products, quantities, trial periods, and various lifecycle states (active, paused, canceled, on grace period).
Transactions represent completed payments. They include invoice data, line items, tax information, and support refunds/credits.
Paddle sends webhook events for important subscription and payment events. Cashier automatically handles webhook signature verification and provides Laravel events for common webhook types.
When swapping plans or changing quantities, Cashier can automatically calculate prorated amounts or you can disable proration using noProrate().
When subscriptions are paused or canceled, they remain active until the end of the current billing period. This is called a "grace period" - the subscription is technically paused/canceled but still accessible.
This skill includes comprehensive documentation in references/:
Use view to read the reference file when detailed information is needed.
references/other.md for complete API documentationswap(), pause(), or refund()namespace App\Http\Middleware;
class Subscribed
{
public function handle(Request $request, Closure $next): Response
{
if (!$request->user()?->subscribed()) {
return redirect('/subscribe');
}
return $next($request);
}
}
Route::get('/dashboard', fn () => '...')->middleware([Subscribed::class]);
// With payment method up front
$checkout = $user->subscribe('pri_monthly')
->returnTo(route('home'));
// Without payment method (generic trial)
$user->createAsCustomer(['trial_ends_at' => now()->addDays(10)]);
// Extend existing trial
$user->subscription()->extendTrial(now()->addDays(5));
// Activate trial early
$user->subscription()->activate();
use Laravel\Paddle\Checkout;
$checkout = Checkout::guest(['pri_34567'])
->returnTo(route('home'));
PADDLE_CLIENT_SIDE_TOKEN=your-paddle-client-side-token
PADDLE_API_KEY=your-paddle-api-key
PADDLE_RETAIN_KEY=your-paddle-retain-key
PADDLE_WEBHOOK_SECRET="your-paddle-webhook-secret"
PADDLE_SANDBOX=true
CASHIER_CURRENCY_LOCALE=nl_BE
CustomerUpdated - Customer information changedTransactionCompleted - Payment completed successfullyTransactionUpdated - Transaction details changedSubscriptionCreated - New subscription createdSubscriptionUpdated - Subscription modifiedSubscriptionPaused - Subscription pausedSubscriptionCanceled - Subscription canceled// Filter subscriptions by status
Subscription::query()->valid();
Subscription::query()->onTrial();
Subscription::query()->active();
Subscription::query()->canceled();
Subscription::query()->paused();
Subscription::query()->onGracePeriod();
Organized documentation extracted from official sources containing:
Add helper scripts here for:
Add templates or examples:
To refresh this skill with updated documentation:
Review code using Linus Torvalds' "good taste" philosophy. Eliminates defensive code, special cases, and deep nesting. Use when reviewing code quality, refactoring, or checking for code smells.
Master end-to-end testing with Playwright and Cypress to build reliable test suites that catch bugs, improve confidence, and enable fast deployment. Use when implementing E2E tests, debugging flaky tests, or establishing testing standards.
Automated contract verification, detection, and remediation across multiple languages using formal preconditions, postconditions, and invariants. This skill provides both reference documentation AND execution capabilities for the full PLAN -> CREATE -> VERIFY -> REMEDIATE workflow.
Build modern full-stack web applications with Next.js (App Router, Server Components, RSC, PPR, SSR, SSG, ISR), Turborepo (monorepo management, task pipelines, remote caching, parallel execution), and RemixIcon (3100+ SVG icons in outlined/filled styles). Use when creating React applications, imp...
Use CloudBase document database Web SDK to query, create, update, and delete data. Supports complex queries, pagination, aggregation, and geolocation queries.
Create and manage database migrations with reversible changes, proper naming conventions, and zero-downtime deployment strategies. Use this skill when creating database migration files, modifying schema, adding or removing tables/columns, managing indexes, or handling data migrations. Apply when ...
Expert guide for Backend.AI distributed computing platform. Automatically activates when users ask about: - Backend.AI architecture, components (Manager, Agent, Storage Proxy, Webserver, App Proxy) - Features (session scheduling, Sokovan orchestrator, multi-tenancy, resource allocation) - APIs (R...
Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. ...
Query Open Targets Platform for target-disease associations, drug target discovery, tractability/safety data, genetics/omics evidence, known drugs, for therapeutic target identification.
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.
Tauri framework for building cross-platform desktop and mobile apps. Use for desktop app development, native integrations, Rust backend, and web-based UIs.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience