Laravel Show Active Subscription Data Example

Laravel 6 , Laravel , Laravel 7




Hi Dev,

In this tutorial, I will explain you how to show active subscription data using stripe in laravel application. This example will help you to give example of active subscription data cashier stripe in laravel application. It's simple example of list active subscription using stripe in laravel cashier.

Here, i will show you active subscription list example. You can see active subscription list using stripe in laravel. We will use stripe subscription using cashier package laravel.

Laravel Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading. In addition to basic subscription management, Cashier can handle: coupons, swapping subscription, subscription "quantities", cancellation grace periods, and more.

Here, I will give you full example for laravel active subscription list example. So let's follow bellow step by step.

Step 1 : Install Laravel Fresh App

In first step, You have to need laravel project. You can install laravel fresh project using bellow composer command:

composer create-project --prefer-dist laravel/laravel blog

Step 2 : Setup Database Configuration

After successfully install laravel app thenafter configure databse setup. We will open ".env" file and change the database name, username and password in the env file.







Step 3 : Set Stripe API Key and SECRET

In this step, You have to need stripe account first you can create stripe account So lets open Stripe official website

Now, we need to set stripe key and secret. so first you can go on (----add link --- {Stripe}) website and create development stripe account key and secret and add bellow:

Get Stripe API Key and SECRET




Step 4 : Add Route

In this step, We will add route in route file so lets open web.php file and add two route first route is form and second route is store stripe subscription.


Route::get('/active-subscription', ['as'=>'home','uses'=>'SubscriptionController@index'])->name('subscription.index');

Step 5 : Create Controller

In this step, you have to create controller as SubscriptionController using bellow artisan command:

php artisan make:controller SubscriptionController



namespace App\Http\Controllers;

use Illuminate\Http\Request;

Use App\User;

use Stripe;

use Session;

use Exception;

class SubscriptionController extends Controller


public function index()


$stripe = new \Stripe\StripeClient(env("STRIPE_SECRET"));

$user = auth()->user();

$dataActive = $stripe->subscriptions->all(['customer' => $user->stripe_id]);

return view('subscription.index',compact('dataActive'));



Step 6 : Create View File

In last step, You can create view blade file first you can create subscription directory then after create index.blade.php file in subscription directory.


<html lang="en">


<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">


<link href="" rel="stylesheet">

<script src=""></script>

<script src=""></script>


<body id="app-layout">

<div class="container">

<div class="row">

<div class="col-md-12 col-md-offset-0">

<h2>Subscription Active Data</h2>

<table class="table table-bordered">






<th>End Date</th>






@foreach($dataActive->data as $key => $value)


<td>{{ ++$key }}</td>

<td>{{ $value->plan->interval }}</td>

<td>${{ $value->plan->amount/100 }}</td>

<td>{{ date('Y-m-d',$value->current_period_end) }}</td>

<td><a class="btn btn-danger" href="">Cancel Subscription</a> </td>











Now we are ready to run our example so run bellow command for quick run:

php artisan serve

Now you can open bellow URL on your browser:


It will help you...

Recommended Posts