Just use Billable; trait on your model
Using Cashier with a different table, other than users (L5.4)?
Is there an easy way that works, to apply Cashier to a table other than users? I'm just using Cashier for subscriptions, and although I have a users table, it's not users that will subscribe, only organisations (held in their own table).
I am assuming I modify the references to user and change them to organisation, here I'm billing with Stripe): https://laravel.com/docs/5.4/billing#stripe-configuration i.e. the migration to modify users table gets changed to orgs, the Billable model references Orgs instead of Users and the API key in services.php also references the Org model:
'stripe' => [
'model' => App\Org::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
then to create a subscription I would do:
$org= Org::find(1);
$org->newSubscription('main', 'premium')->create($stripeToken);
Anything else I'm missing?
Thanks, Alex
Please or to participate in this conversation.