Billable Models
A billable is any Eloquent model that can hold subscriptions. Typically this is yourUser model, but it can be any model — a Team, Organisation, or Project works equally well.
Setting up a billable model
Implement theBillable contract and add the ManagesBilling trait:
Register the billable type
Add your billable class toconfig/subscribd.php under the billables key:
user) is used internally when storing polymorphic relationships and in the Filament admin panel’s transfer action dropdown.
Multiple billable types
You can register as many billable types as your application needs:Billable and uses ManagesBilling independently.
Relationships
TheManagesBilling trait provides the following Eloquent relationships:
Subscription helpers
Invoice helpers
Payment method helpers
Billing identity
Subscribd reads these methods when communicating with gateways. Override them if your model uses different column names:Gateway customer IDs
Subscribd stores gateway customer IDs in a JSON column on your billable table. Run the migration published byvendor:publish --tag=subscribd-migrations to add this column, or add it manually:
subscribd_stripe_id, etc.), the getter falls back to those columns automatically. Run php artisan subscribd:migrate-customer-ids to backfill the JSON column.
Next steps
- Plans — Define your pricing tiers
- Creating Subscriptions — Subscribe a billable to a plan
- Checking Features — Gate application features by plan