$npx -y skills add fusengine/agents --skill laravel-billingIntegrate Stripe and Paddle payments with Laravel Cashier. Use when implementing subscriptions, invoices, payment methods, webhooks, or billing portals.
| 1 | # Laravel Billing (Cashier) |
| 2 | |
| 3 | ## Agent Workflow (MANDATORY) |
| 4 | |
| 5 | Before ANY implementation, use `TeamCreate` to spawn 3 agents: |
| 6 | |
| 7 | 1. **fuse-ai-pilot:explore-codebase** - Check existing billing setup, User model |
| 8 | 2. **fuse-ai-pilot:research-expert** - Verify latest Cashier docs via Context7 |
| 9 | 3. **mcp__context7__query-docs** - Query specific patterns (Stripe/Paddle) |
| 10 | |
| 11 | After implementation, run **fuse-ai-pilot:sniper** for validation. |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | ## Overview |
| 16 | |
| 17 | Laravel Cashier provides subscription billing with Stripe or Paddle. Choose based on your needs: |
| 18 | |
| 19 | | Provider | Package | Best For | |
| 20 | |----------|---------|----------| |
| 21 | | **Stripe** | `laravel/cashier` | Full control, high volume, complex billing | |
| 22 | | **Paddle** | `laravel/cashier-paddle` | Tax handling, compliance, global sales | |
| 23 | |
| 24 | ### Key Difference: MoR vs Payment Processor |
| 25 | |
| 26 | | Aspect | Stripe | Paddle | |
| 27 | |--------|--------|--------| |
| 28 | | **Type** | Payment Processor | Merchant of Record | |
| 29 | | **Taxes** | You manage (or Stripe Tax) | Paddle manages automatically | |
| 30 | | **Invoices** | Your company name | Paddle + your name | |
| 31 | | **Compliance** | Your responsibility | Paddle handles | |
| 32 | | **Fees** | ~2.9% + $0.30 | ~5% + $0.50 (all-inclusive) | |
| 33 | |
| 34 | --- |
| 35 | |
| 36 | ## Critical Rules |
| 37 | |
| 38 | 1. **Use webhooks** - Never rely on client-side confirmations |
| 39 | 2. **Handle grace periods** - Allow access until subscription ends |
| 40 | 3. **Never store card details** - Use payment tokens/methods |
| 41 | 4. **Test with test keys** - Always before production |
| 42 | 5. **Verify webhook signatures** - Prevent spoofing attacks |
| 43 | 6. **Handle incomplete payments** - 3D Secure requires user action |
| 44 | |
| 45 | --- |
| 46 | |
| 47 | ## Architecture |
| 48 | |
| 49 | ``` |
| 50 | app/ |
| 51 | ├── Http/ |
| 52 | │ ├── Controllers/ |
| 53 | │ │ └── Billing/ ← Billing controllers |
| 54 | │ │ ├── SubscriptionController.php |
| 55 | │ │ ├── CheckoutController.php |
| 56 | │ │ └── InvoiceController.php |
| 57 | │ └── Middleware/ |
| 58 | │ └── EnsureSubscribed.php ← Subscription check |
| 59 | ├── Models/ |
| 60 | │ └── User.php ← Billable trait |
| 61 | ├── Listeners/ |
| 62 | │ └── StripeEventListener.php ← Webhook handling |
| 63 | └── Services/ |
| 64 | └── BillingService.php ← Business logic |
| 65 | |
| 66 | config/ |
| 67 | ├── cashier.php ← Stripe/Paddle config |
| 68 | └── services.php ← API keys |
| 69 | |
| 70 | routes/ |
| 71 | └── web.php ← Webhook routes (excluded from CSRF) |
| 72 | ``` |
| 73 | |
| 74 | --- |
| 75 | |
| 76 | ## FuseCore Integration |
| 77 | |
| 78 | When working in a **FuseCore project**, billing follows the modular structure: |
| 79 | |
| 80 | ``` |
| 81 | FuseCore/ |
| 82 | ├── Core/ # Infrastructure (priority 0) |
| 83 | │ └── App/Contracts/ |
| 84 | │ └── BillingServiceInterface.php ← Billing contract |
| 85 | │ |
| 86 | ├── User/ # Auth module (existing) |
| 87 | │ └── App/Models/User.php ← Add Billable trait here |
| 88 | │ |
| 89 | ├── Billing/ # Billing module (new) |
| 90 | │ ├── App/ |
| 91 | │ │ ├── Http/ |
| 92 | │ │ │ ├── Controllers/ |
| 93 | │ │ │ │ ├── SubscriptionController.php |
| 94 | │ │ │ │ ├── CheckoutController.php |
| 95 | │ │ │ │ └── WebhookController.php |
| 96 | │ │ │ └── Middleware/ |
| 97 | │ │ │ └── EnsureSubscribed.php |
| 98 | │ │ ├── Listeners/ |
| 99 | │ │ │ └── HandleWebhookEvents.php |
| 100 | │ │ └── Services/ |
| 101 | │ │ └── BillingService.php |
| 102 | │ ├── Config/ |
| 103 | │ │ └── cashier.php ← Module-level config |
| 104 | │ ├── Database/Migrations/ |
| 105 | │ ├── Routes/ |
| 106 | │ │ ├── web.php ← Webhooks (no CSRF) |
| 107 | │ │ └── api.php ← Subscription management |
| 108 | │ └── module.json # dependencies: ["User"] |
| 109 | ``` |
| 110 | |
| 111 | ### FuseCore Billing Checklist |
| 112 | |
| 113 | - [ ] Billing code in `/FuseCore/Billing/` module |
| 114 | - [ ] Billable trait on User model in `/FuseCore/User/` |
| 115 | - [ ] Webhook routes in `/FuseCore/Billing/Routes/web.php` |
| 116 | - [ ] Exclude webhook from CSRF in `VerifyCsrfToken` |
| 117 | - [ ] Declare `"User"` dependency in `module.json` |
| 118 | |
| 119 | → See [fusecore skill](../fusecore/SKILL.md) for complete module patterns. |
| 120 | |
| 121 | --- |
| 122 | |
| 123 | ## Decision Gui |