alfasix / alfakit-billing
Subscription billing for AlfaKit panels: Stripe (Laravel Cashier), Paddle (Cashier Paddle) and Laravel Spark providers, a plans page and subscription middleware, for tenants or users.
Requires
- php: ^8.3
- alfasix/alfakit: ^0.1|@dev
Requires (Dev)
None
Suggests
- laravel/cashier: For the StripeBillingProvider (Stripe, ^15.0|^16.0).
- laravel/cashier-paddle: For the PaddleBillingProvider (Paddle Billing).
- laravel/spark-stripe: For the SparkBillingProvider (paid, https://spark.laravel.com).
Provides
None
Conflicts
None
Replaces
None
README
by Alfa Six
Subscription billing for AlfaKit panels: Stripe (Laravel Cashier), Paddle (Cashier Paddle) and Laravel Spark providers, a plans page and subscription middleware. Tenancy panels bill the tenant; other panels bill the signed-in user.
Installation
composer require alfasix/alfakit-billing
Set up Laravel Cashier (migrations, keys, webhook) and add Laravel\Cashier\Billable to the model that pays.
Registering
use AlfaSix\AlfakitBilling\BillingPlugin; use AlfaSix\AlfakitBilling\Plan; use AlfaSix\AlfakitBilling\Providers\StripeBillingProvider; $panel->plugin( BillingPlugin::make() ->provider( StripeBillingProvider::make() ->plans([ Plan::make('pro')->price('price_123')->label('Pro') ->amount(29, 'usd')->monthly() ->features(['Unlimited projects', 'Priority support']), ]) ->trialDays(14), ) ->requiresSubscription(), );
/{tenant}/billing(or/billing) opens the Stripe Billing Portal for subscribers and the plans page for everyone else;?plan=prostarts Stripe Checkout.- A Billing entry is added to the tenant menu (or the user menu without tenancy).
requiresSubscription()sends unsubscribed tenants or users to the plans page.
PaddleBillingProvider (needs laravel/cashier-paddle; it requires Guzzle 7, which Laravel 13 supports) and SparkBillingProvider (needs Laravel Spark) work the same way and throw a clear exception until their package is installed.
See the documentation for every option.
Testing
vendor/bin/pest --test-directory=packages/plugins packages/plugins/billing
License
MIT. See LICENSE.md.