Skip to content

Commit 9c29031

Browse files
Clarify billable model limitations on Spark Stripe (#11)
* Update configuration.md * Update configuration.md Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
1 parent a92980c commit 9c29031

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

2.x/spark-stripe/configuration.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,24 @@ For Stripe to be able to send your application webhooks during local development
4747

4848
## Configuring Billables
4949

50-
Spark allows you to define the types of billable models that your application will be managing. Most commonly, applications bill individual users for monthly and yearly subscription plans. However, your application may choose to bill some other type of model, such as a team, organization, band, etc.
50+
Spark allows you to define the types of billable models that your application will be managing. Most commonly, applications bill individual users for monthly and yearly subscription plans. However, your application may choose to bill some other type of model, such as a team, organization, band, etc. The Stripe edition of Spark currently only supports a single billable model entity (team, user, etc.) per application.
5151

52-
You may define your billable models within the `billables` array of your application's `spark` configuration file. By default, this array contains an entry for the `App\Models\User` model.
52+
You may define your billable models within the `billables` array of your application's `spark` configuration file. By default, this array contains an entry for the `App\Models\User` model. If the billable model is something other than `App\Models\User`, you should invoke Cashier's `useCustomerModel` method in the `boot` method of your `AppServiceProvider` class in order to inform Cashier of your custom model:
53+
54+
```php
55+
use App\Entities\User;
56+
use Laravel\Cashier\Cashier;
57+
58+
/**
59+
* Bootstrap any application services.
60+
*
61+
* @return void
62+
*/
63+
public function boot()
64+
{
65+
Cashier::useCustomerModel(User::class);
66+
}
67+
```
5368

5469
Before continuing, you should ensure that the model class that corresponds to your billable model is using the `Spark\Billable` trait and that it casts the `trial_ends_at` attribute to `datetime`:
5570

0 commit comments

Comments
 (0)