--- name: cashier-paddle-development description: "Handles Laravel Cashier Paddle integration including subscriptions, webhooks, Paddle Checkout, transactions, charges, refunds, trials, proration, pausing, and multiple subscription types. Triggered when a user mentions Cashier, Billable, paddle_id, subscribe(), checkout(), Paddle subscriptions, or billing. Also applies when setting up webhooks, debugging subscribed() returning false, handling grace periods, testing with CashierFake, or troubleshooting subscription sync issues." license: MIT metadata: author: laravel --- @php /** @var \Laravel\Boost\Install\GuidelineAssist $assist */ @endphp # Cashier Paddle Development ## When to Apply Activate this skill when: - Installing or configuring Laravel Cashier Paddle - Setting up subscriptions, trials, quantities, or plan swapping - Handling webhooks or subscription state sync issues - Working with Paddle Checkout, transactions, or one-time charges - Testing billing scenarios with CashierFake - Debugging `subscribed()` returning false or subscription type mismatches ## Documentation Use `search-docs` for detailed Cashier Paddle patterns and documentation covering subscriptions, webhooks, Paddle Checkout, transactions, payment methods, and testing. For deeper guidance on specific topics, read the relevant reference file before implementing: - `references/subscriptions.md` covers subscription creation, status checks, swapping, pausing, trials, quantities, and multiple products - `references/webhooks.md` covers webhook setup, custom handlers, CSRF exclusion, and local development with reverse proxies - `references/testing.md` covers CashierFake, API response mocking, and feature test patterns for billing code ## Basic Usage ### Installation ```bash {{ $assist->artisanCommand('vendor:publish --tag="cashier-migrations"') }} {{ $assist->artisanCommand('migrate') }} {{ $assist->artisanCommand('vendor:publish --tag="cashier-config"') }} ``` ### Environment Variables ``` PADDLE_CLIENT_SIDE_TOKEN=your-client-side-token PADDLE_API_KEY=your-api-key PADDLE_WEBHOOK_SECRET=your-webhook-secret PADDLE_SANDBOX=true CASHIER_CURRENCY_LOCALE=en ``` ### Billable Model @boostsnippet("Add Billable Trait", "php") use Laravel\Paddle\Billable; class User extends Authenticatable { use Billable; } @endboostsnippet If you bill a non-`User` model, add the `Billable` trait to that model as well: @boostsnippet("Custom Billable Model", "php") use Illuminate\Database\Eloquent\Model; use Laravel\Paddle\Billable; class Team extends Model { use Billable; } @endboostsnippet No extra Cashier registration call is required for additional billable models. Add `@paddleJS` to your layout so Paddle's JavaScript is loaded for the overlay checkout: @boostsnippet("Paddle JS Directive", "blade")
@paddleJS @endboostsnippet ### Creating a Subscription Cashier Paddle uses a checkout-based flow. `subscribe()` returns a `Checkout` instance that is passed to a Blade component. There is no direct API call for subscription creation. @boostsnippet("Subscription Checkout Route", "php") Route::get('/subscribe', function (Request $request) { $checkout = $request->user() ->subscribe('pri_monthly', 'default') ->returnTo(route('dashboard')); return view('billing', ['checkout' => $checkout]); }); @endboostsnippet @boostsnippet("Subscription Checkout Button", "blade")