Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Laravel Subscriptions (with Inertia.js v2 & Vue 3)
21 students

Laravel Subscriptions (with Inertia.js v2 & Vue 3)

Learn how to start accepting subscriptions with Laravel and build a solid foundation for your next application.
Created byTapan Sharma
Last updated 3/2025
English
English [Auto],

What you'll learn

  • Learn how to implement a flexible subscriptions system in a Laravel Application using Cashier
  • Learn how to create Stripe Checkout Sessions with Laravel Cashier.
  • Learn how to allow Promotion codes and Subscription Trials to improve conversions in a subscription system.
  • Learn how to configure and listen for Webhook Events from Stripe, along with custom webhook events.
  • Learn how to implement displaying and downloading invoices so that our customers can view all the past payments that they've made.
  • Learn how to handle Past Due payments along with allowing them access to our protected area, or prevent the access accordingly.
  • We'll also learn how to define dedicated middleware's to check for the subscription status of the User, and allow access accordingly.
  • Learn how to implement Lifetime Memberships so that our customers can pay once and use our services forever.
  • We'll also learn how to listen for custom webhook events from Stripe and using this feature, send an Email to our customer when their subscription ends.

Course content

2 sections • 28 lectures • 4h 42m total length
  • Install and Setup Laravel5:56

    Install a fresh Laravel project with the installer or composer and create a Laravel Subscriptions app. Set up Vue with Inertia stack using Breeze and Inertia SSR, with optional TypeScript.

  • Adjusting Laravel Breeze13:18

    Customize the default Laravel Breeze with Inertia and Vue by rendering a custom home page via an invokable controller, and adjust authenticated layouts and guest navigation.

  • Creating and Storing Plans Data7:14

    Store subscription plants data in a dedicated Laravel config file (subscriptions.php), defining monthly and yearly plans and retrieving Stripe price IDs to render them.

  • Displaying the Plans9:30

    Render monthly and yearly subscription plans on the front end by defining a route and controller with inertia, loading data from subscriptions config, and passing it to the plans component.

  • Installing and Configuring Cashier6:33

    Install and configure laravel cashier for stripe, publish migrations, migrate, and apply the billable trait to the user model. Prepare env keys and price IDs for checkout sessions.

  • Creating a Checkout Session11:36

    Implement a checkout session using Laravel Cashier and Stripe, routing plant clicks to Stripe's checkout flow and fetching the plan price ID from the subscriptions config.

  • Validating Plans on Checkout3:48

    Validate the front-end plan input before stripe checkout by checking the selected plan against registered plans and redirecting invalid ones to the plans page or a 404.

  • Allowing Promotion Codes2:51

    Enable promotion codes in the checkout flow to let users enter discounts, and create coupons in Stripe with percentage or fixed discounts, plus configure webhooks for Laravel.

  • Configuring Webhooks18:19

    Configure Stripe webhooks and handle subscription events with Laravel Cashier, using endpoints, local testing with ngrok or expose, and CSRF exemptions.

  • Checking If a Customer is Subscribed3:32

    Check a customer's subscription status in the backend using the billable trait and subscribed method, then send status to the frontend with Inertia.js and Vue 3 to render gated content.

  • Protecting Routes7:07

    Protect a route by building a dedicated protected controller, view, and middleware that redirects non-subscribed users to the plans page, ensuring only subscribed users access the page.

  • Rendering UI Elements Conditionally6:08

    Use a user API resource to pass subscribed status, render navigation conditionally, and protect pages on both front end and back end, while disabling API wrapping.

  • Redirecting to the Billing Portal20:04

    Create a user billing area with Stripe integration, enabling subscription management, updating payment details, and redirecting to the Stripe billing portal via Inertia routes and a subscription controller.

  • Displaying Plan Details20:32

    Learn to display a subscribed user's plan details by fetching data from Stripe via Laravel Cashier, formatting it with decorators, and rendering currency and renewal info.

  • Showing Renewal Date and Next Charge6:57

    Learn to display the next subscription renewal date and total charge in a Laravel app using Cashier, retrieving the upcoming invoice, formatting with Carbon, and rendering it on the frontend.

  • Canceling and Resuming Subscriptions15:42

    Implement canceling and resuming subscriptions with Laravel Cashier, exposing subscription data to the frontend, and creating resume and cancel routes and components for seamless user control.

  • Syncing Customer Details5:06

    Learn to keep customer details in sync with Stripe by using a user observer to trigger Laravel Cashier's sync Stripe customer details when a user updates.

  • Displaying Invoices7:58

    Display and download invoices within the subscription page. Build an invoice resource to format date and total, pass data from the controller, and render via a Vue component.

  • Downloading Invoices6:29

    Enable authenticated users to download invoices by passing each invoice id through the backend to the invoice.download route, leveraging Laravel Cashier and dompdf to generate and deliver pdf invoices.

  • Custom Webhook Events11:15

    Listen for custom webhook events from Stripe in a Laravel app, define a webhook listener for subscription created, and log payloads to react with actions like sending emails.

  • Sending an Email when Subscription Ends9:35

    Listen for the subscription ended webhook, identify the user via Stripe ID with Laravel Cashier, and send an email notification using a dedicated subscription ended mail, tested with Mailtrap.

  • Subscription Trials8:52

    Enable Stripe subscription trials in Laravel Cashier, configure trial days, and display days remaining until the trial ends in the UI, using on trial status to conditionally render.

  • Non Subscriber and other Middlewares7:40

    Define and apply middlewares like redirect if subscribed, redirect if not subscribed, cancelled, and not cancelled to manage access across plans, resume, cancel, and the stripes portal.

  • Dealing with Past Due Payments15:39

    Explore how past due payments impact Laravel subscriptions, simulate Stripe failures, and implement cashier to keep access to protected content and notify users to update their card details.

  • Fixing Remaining Issues5:04

    Fix remaining issues in the Laravel Subscriptions course by applying optional chaining to plan and currency, and validating Stripe purchases, cancellations, and resumes.

Requirements

  • Beginner Level of PHP/Laravel is required.
  • Beginner Level of Vue.js 3 and Inertia.js would be helpful

Description

Learn how to start accepting subscriptions with Laravel and build a solid foundation for your next application.

This course will teach you everything you need to know to implement a flexible subscription system on a typical Laravel Project.


Even if you’re completely new to Laravel, by the end of this course you’ll have a platform where customers can purchase subscriptions and gain access to restricted areas of your application.

We’ll also cover managing subscriptions, cancellations, invoices, giving customers trial periods, allowing promotion codes — and more.


We'll cover the following  topics along the way:


  • Learn how to install and configure Laravel Cashier for Stripe to accept payments in your Laravel App.

  • Learn how to adjust and make necessary changes on a default Laravel Breeze Boilerplate for implementing a Subscriptions System.

  • Learn to create a store plan's data on a configuration file and query the plan's data accordingly.

  • Learn how to create Stripe Checkout Sessions with Laravel Cashier.

  • We'll also allow promotion codes so that customers can enter promotion codes to receive discounts on special occasions like Black Friday Deals.

  • We'll also learn how to configure webhooks in our Laravel Application which will allow us to listen for stripe webhook events and act on them accordingly based on the type of event that has occurred.

  • Learn how to define protected routes and views that can only be accessed by customers who have a valid subscription.

  • We'll also learn how to redirect the customers to Stripe's Billing Portal where they can manage their subscription details like cards, cancel and resume subscriptions, update personal details, and so on.

  • We'll also learn how to implement subscription trials to allow our customers to access our protected area for some days before they commit to paying the subscription fee.

  • We'll also learn how to implement displaying and downloading invoices so that our customers can view all the past payments that they've made.

  • Learn how to define a dedicated subscription area where the customers can view and manage their subscription details like canceling and resuming subscriptions, the next renewal date, and total charge along with plan details and so on.

  • We'll also let them swap to a lifetime subscription from the subscription page itself.

  • We'll also learn how to handle past due payments, and we'll also look at how we can either let them access our protected area, or prevent the access accordingly, if in case our customer ends up in a past due state.

  • We'll learn how to define dedicated middleware to check for the subscription status of the User,  and allow access accordingly, we'll also define middleware to check for the user's subscription cancellation status.

  • Learn how to listen for specific webhook events sent by Stripe and act on them accordingly, using this feature, we'll send an Email to our customers when their subscription ends.


And finally, in our second section, we'll implement Lifetime Memberships in our subscriptions system, we'll learn the following along the way:

  • Learn how to implement a Stripe Checkout Session to accept a one-time payment from our customers.

  • We'll also make necessary changes to our subscription system to implement Lifetime Memberships.

  • We'll learn how to cancel the customer's existing subscription (if they have any) when swapping their membership for a lifetime membership.

Who this course is for:

  • PHP/Laravel Developers who want to implement a subscription system on their Laravel Applications.