Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
implement-subscription-billing
implement-subscription-billing
alizharb/agent-skills
claude-code
cashier
stripe
webhooks
billing-portal
subscriptions
middleware

Use when configuring Laravel Cashier, setting up billing portals, handling S3/Stripe webhooks, or verifying user tiers.

Install
php artisan boost:add-skill alizharb/agent-skills

Save this content to: .claude/skills/implement-subscription-billing/SKILL.md

# Implement Subscription Billing

## When To Use

Use this skill when installing Cashier, managing customer plans, redirecting users to the Stripe portal, or subscribing users to a plan.

## Workflow

1. **Verify Billable Trait**: Ensure the user model uses the `Laravel\Cashier\Billable` trait.
2. **Setup Billing Portal**: Register routes to redirect users to Stripe's Customer Portal.
3. **Configure Webhooks**: Expose a webhook endpoint and register the Stripe webhook key in `.env`.
4. **Enforce Access**: Create middleware to check for active plans.

## Examples

### Good Example

```php
// app/Http/Controllers/BillingController.php
namespace App\Http\Controllers;

use Illuminate\Http\Request;

final class BillingController
{
    public function portal(Request $request)
    {
        // Redirect the user to Stripe's customer billing dashboard
        return $request->user()->redirectToBillingPortal(
            route('dashboard')
        );
    }
}
```

```php
// app/Models/User.php
namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Cashier\Billable;

final class User extends Authenticatable
{
    use Billable;
}
```

### Bad Example

```php
// ❌ Creating direct payments using custom Stripe API Curl calls
// Cashier handles invoice generation, tokens, and customers automatically.
```
---

Implement Subscription Billing

When To Use

Use this skill when installing Cashier, managing customer plans, redirecting users to the Stripe portal, or subscribing users to a plan.

Workflow

  1. Verify Billable Trait: Ensure the user model uses the Laravel\Cashier\Billable trait.
  2. Setup Billing Portal: Register routes to redirect users to Stripe's Customer Portal.
  3. Configure Webhooks: Expose a webhook endpoint and register the Stripe webhook key in .env.
  4. Enforce Access: Create middleware to check for active plans.

Examples

Good Example

// app/Http/Controllers/BillingController.php
namespace App\Http\Controllers;

use Illuminate\Http\Request;

final class BillingController
{
    public function portal(Request $request)
    {
        // Redirect the user to Stripe's customer billing dashboard
        return $request->user()->redirectToBillingPortal(
            route('dashboard')
        );
    }
}
// app/Models/User.php
namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Cashier\Billable;

final class User extends Authenticatable
{
    use Billable;
}

Bad Example

// ❌ Creating direct payments using custom Stripe API Curl calls
// Cashier handles invoice generation, tokens, and customers automatically.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle