Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

basiltap's avatar

Is it possible to use Cashier Stripe into a Package?

I'm trying to use Laravel into a custom package to use the Stripe Integration. I have followed the documentation, but I receive an error:

Trait 'Laravel\Cashier\Billable' not found

I have an User model in the package. The documentation says to put it in the AppServiceProvider, but it doesn't work neither in the package not in the main app.

What am I missing?

The error is coming from here, in the package:


use Basiltap\Subscription\Models\Subscription;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Laravel\Cashier\Billable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable, Billable;
0 likes
4 replies
martinbean's avatar

@basiltap I don’t really follow what it is you’re trying to do. What do you mean you’re trying to “use Laravel into a custom package”?

basiltap's avatar

@martinbean, I will try to explain myself better:

I have to install a payments and subscription system in an app with several payment methods (Stripe and PayPal at the moment, but also others in next projects). As there are upcoming projects with similar needs, I decided to create a package for subscriptions and payments.

In the package, when you choose the payment method in checkout page, a resolver send to different service, depending on payment methods. In Stripe service, in order to take advance the functionality of cashier-stripe, i wantet to use it inside the package, not installing it in the main app, but inside the package, to create, cancel, swap subscriptions, etc. I will also do the same later in the PayPal (or other) service.

Then, I have required the Cashier stripe into the package, where I'm using an User Model. But when I import the Billable method in the package User, it comes with an error: Trait 'Laravel\Cashier\Billable' not found

martinbean's avatar

Then it sounds like laravel/cashier isn’t in your package’s dependencies.

Please or to participate in this conversation.