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

JoakimR's avatar

Extending Laravel Cashier functionality

Hey! I'm currently working on a project that requires using more of the Stripe API than Cashier currently has to offer, in this case; creating and updating products and prices in Stripe.

Connecting to and using the API is fairly easy, but I'm not quite sure how I should structure the files accoring to the Laravel conventions.

Right now I have all of the code placed in a "App\Models\Stripe" folder, with a "Stripe" parent model that opens the API-connection and the Product and Price models that extends the "Stripe" model to access the API client.

I am able to create and update the products and prices in Stripe, but this is where I start getting confused. Cause I would also like to have all of these products and prices stored in the database connected to the Laravel project and syncronized when any changes are made.

Do I create seperate models for interacting with Eloquent for the products and prices and call these within the Stripe models after successfully storing and/or updating something? (I feel this is the wrong way to do it)

Or is there some cleaner or more elegant way to achieve this that I have missed or not learned about yet? Would appreciate any input, tips and/or links on how to best solve this.

0 likes
2 replies
JoakimR's avatar

I think I might have figured a better solution to this problem than previously.

Now I create the products and prices to the application's database first using the Eloquent models, and then use observers to create and update them in Stripe using the Stripe models I have created.

martinbean's avatar

@joakimr I’d personally use Stripe as the source of truth for data. So I’d create the products and prices in Stripe, and then use webhooks to create/update products and prices in my database.

Please or to participate in this conversation.