Skip to content
Example Laravel application to show how Cashier v10 can be implemented for subscription apps
Branch: master
Clone or download
Latest commit 99851e0 Sep 4, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
public Completed subscription frontend :) Aug 6, 2019
artisan 🐤 Initial commit Aug 4, 2019

Laravel Cashier v10 Example

Example Laravel application to show how Cashier v10 can be implemented for subscription apps

Cashier v10 is the lastest version of Laravel Cashier. It has support for Strong Customer Authentication (SCA) which is a new payment flow that will be required for online payments from mid-September 2019.

I created this sample application because I wanted a place to test Cashier v10 before implementing it in my production Saas application. This example app is a fake subscription Saas type app where you enter your billing inofmrtaion at user registration.


I'm guessing you know how Laravel apps are installed so I'll miss out the basics. Just a few notes though:

  • Remember to enter Stripe keys into .env file (remember to copy that from .env.example)
  • Remember to compile assets from Mix npm run watch or yarn run watch (and install the node deps)


In my example app, I'm using VueJS as my front-end framework. All of the JavaScript stuff is in my resources/js directory and it is all compiled by Laravel Mix.

If you're trying to setup Stripe with VueJS and Mix, instead of putting your API keys directly into your JavaScript, add this additonal line.


And then in your Vue files, you can refrence the Stripe key like this:



The backend is fairly basic, the only place where there is any real custom logic is in the Auth\RegisterController. The create method is one Laravel gives you where you can put any custom logic you need to do after a user has been registered.

In there, we just go ahead and create the user and subscribe them to a new plan, in our case the plan is called cashier_standard (first one is what it is in Stripe, second the one for your database) and we also pass along the Stripe Payment Method generated by the JavaScript frontend.

If the payment is successful after registration the user will be redirected to the home, if not they will be directed to a 'Complete Payment' screen (Provided by Cashier) to do any additional verification steps required by the customer's bank.


If you need to create real customers in Stripe while running your tests (please do this in test mode), I've included a little helper class which will generate a Stripe Payment Method for you to use when creating a subscription in your tests.


use App\Services\GeneratePaymentMethod;


$paymentMethod = (new GeneratePaymentMethod())->generate();

$user = factory(\App\User::class)->create();

$user->newSubscription('stripe_plan', 'app_plan')

Any issues

If you have any issues regarding this example or are a bit confused, please create an issue and I'll try and help the best I can.

You can’t perform that action at this time.