Using Laravel Cashier with VueJS SPA and Laravel Passport API
Connect Laravel Cashier with your Laravel Passport API through a VueJS Single Page Application! Course uses Laravel 6.x
Managing subscriptions within your product can be a massive pain in the you know what. Luckily with Laravel Cashier and Stripe, this is so much less of a burden. However, the speed at which Stripe changes makes it hard to keep track of how to implement the payment system. I also found some of the Laravel Cashier documentation a little bit tricky to follow with all of the different variables that Stripe has to offer. Let alone, when you are letting the user subscribe to your application through a Single Page Application (SPA) to an API, the process adds an entirely different level of complexity.
This small course will go over the process of installing Laravel Cashier and allowing users to subscribe to your application, save their payment for future use, and swap subscriptions in the future. Along the way we will touch on some of the tips and tricks to make this process work. Even if you aren’t using an SPA and API type structure for your application, you can still benefit from the tips and tricks that have come up using Stripe.
Pre-Requisites
The pre-requisites for this course are a functional Laravel 6.x Install and a basic Single Page Application set up with VueJS. If you don’t have one set up, you can follow this tutorial (API Driven Development With Laravel and VueJS https://serversideup.net/courses/api-driven-development-laravel-vuejs/ ) to help get you to where you need to be. Not much has changed with the installation from 5.6 – 6.x for what we are using so it should still be accurate.
You will also need the Laravel Passport package installed and configured. The instructions here: https://laravel.com/docs/6.x/passport should help you out! In the tutorial I wrote above, we use Laravel 5.6. The process is very similar so if this article helps: https://serversideup.net/installing-configuring-laravel-passport/ feel free to use it!
Let’s get started!
- - How to enable users to subcribe to your app through an API using an SPA
- - Save Stripe credit card payment details for your users through an API
- - Allow users to manage their subscription to your app through an SPA