Back to Top

Laravel eCommerce SaaS Subscription

Updated 27 September 2024

Laravel eCommerce SaaS Subscription extension allows the super admin to create custom plans for the tenants. Moreover, the super admin can create multiple types of plans that can be created according to products, categories, attributes, and attribute family.

Also, the tenant can purchase a subscription plan to use the eCommerce SaaS platform.

Check a brief overview of the plugin –

VADf8J0qwPc

Important Note:- This module is an add-on of Webkul’s Laravel eCommerce Multi-Company SaaS Module, so for using this module you need to install the Webkul’s Laravel eCommerce Multi-Company SaaS Module

Features of Laravel Ecommerce SaaS Subscription

  • Super admin can create multiple custom plans.
  • This extension support the trial plan.
  • Super admin can allow a trial plan for the tenant.
  • The super admin can set the period of the plan.
  • Super admin can set custom plan for trial.
  • The tenant can purchase plans according to their need.
  • The module supports Stripe/Paypal payment gateways.
  • Supported automated recurring billing with Stripe.
  • Integration with Stripe webhooks for real-time events.

Module Installation

Unzip the respective extension zip and then merge “packages” and “storage” folders into the project root directory.

Start your headless eCommerce
now.
Find out More
Bagisto-Laravel-eCommerce-SaaS Subscription-installation

Goto config/app.php file and add following line under ‘providers’

Webkul\SAASSubscription\Providers\SAASSubscriptionServiceProvider::class

Then Goto composer.json file and add following line under ‘psr-4’

"Webkul\\SAASSubscription\\": "packages/Webkul/SAASSubscription/src"

Goto config/concord.php and packages/Webkul/Core/src/Config/concord.php files and add following line under ‘modules‘ index in both files:

\Webkul\SAASSubscription\Providers\ModuleServiceProvider::class

Goto app/Http/Middleware/VerifyCsrfToken.php file and add following line under ‘$except‘ variables:

$except = [
    'super/paypal/ipn'
];

Goto config/bagisto-vite.php file and add following line under ‘viters‘ index:

'saas-subscription' => [
    'hot_file'                 => 'saas-subscription-vite.hot',
    'build_directory'          => 'themes/saas-subscription/default/build',
    'package_assets_directory' => 'src/Resources/assets',
],

Goto packages/Webkul/Sales/src/Repositories/OrderRepository.php file and add following line under create method before return $this->createOrderIfNotThenRetry($data); line:

$resources = app('Webkul\SAASSubscription\Helpers\Subscription')->getLeftResources('orders');
        
if(! $resources['remaining']) {
    Event::dispatch('checkout.order.save.before', [$data]);
}

Run these commands below to complete the setup

composer dump-autoload
php artisan migrate
php artisan route:cache
php artisan vendor:publish --force

-> Press 0 and then press enter to publish all assets and configurations.

Setup Stripe:

a. First install Stripe dependance.

composer require stripe/stripe-php

Update Stripe Webhook URL

Update your Stripe dashboard to use the webhook URL you defined.

Go to Developers > Webhooks in your Stripe dashboard, and set the endpoint to your webhook URL, e.g., https://super-admin-domain.com/webhook.

1. Stripe Webhook Setup: Create a webhook endpoint to handle invoice.payment_succeeded events.

Setup Paypal:

Save Instant payment notifications URL in PayPal.

That’s it, now just execute the project on your specified domain.

Follow the below steps to enable IPN settings in your PayPal account

  1. Go to the Paypal Website
  2. Signin into your PayPal account.
  3. Click on the “Profile” icon in the right hand corner and then on “Profile & Settings“.
  4. At the left hand side you will see “Setting Tool” click on that.
  5. Once you are there you will find “Getting Paid & Managing my risk”
  6. Under you will find the “Instant Payment Notification” then click on the “Update”
  7. To unable IPN Click “Choose IPN Settings
  8. Under the next page enter your “Notification URL” also choose “Rececive IPN Message”
  9. Lastly Click on the “Save” button
bagisto-laravel-ecommerce-multi-company-saas-subscription-IPN-settings-2

Also you can check this video tutorial to enable the IPN settings into your Paypal account
https://youtu.be/eSgQgAjSVys

The IPN message is always sent to your notification URL unless you have disabled the preference to receive IPN messages.

Module Configuration: Laravel Ecommerce SaaS Subscription

Once you have successfully installed the module, now let’s go to the module configuration settings by navigating to Configure>>Subscription>>Subscription payment settings.

subscription-version-1

Allow Trial

From the drop-down the super admin can allow the trail of the Subscription Plan to the Tenants by selecting “Yes” else they can choose “No

Trial Days

Here the super admin can mention the number of trial days of the Subscription Plan

Trial Plan

Now the super admin can choose the trails plan from the drop-down.

Payment Method

The super admin will configure the settings for the payment method as shown in the snapshot.

Here, Super admin can select the Stripe or Paypal Payment gateway for the tenant.

Stripe Settings

The super admin will get all the above details such as stripe publishable key, secret key, webhook secret key.

stripe-payment

PayPal Settings

The super admin will get all the above details such as Paypal user name, password, and signature under their PayPal merchant account.

subscription-version-2

Manage extension assignment status.

Sandbox Mode

Select Yes to enable the testing mode else select No to make use of the Live mode.

Merchant PayPal Id

Enter your Merchant PayPal Id within the space provided.

User Name

Enter your PayPal User Name.

Password

Enter your PayPal password.

Signature

Enter your PayPal Signature

Extension Assignment Setting

Select ‘Yes‘ to enable the Extension Assignment status and ‘No‘ to disable it.

Super Admin – eCommerce Subscription Extension

Once you have done with the configuration settings, now let’s move to the Subscription section

As you can see in the below image the super admin will find further 3 more subsections as Plans, Purchase Plan & Invoice.

Under the Plans section you will find all the Subscription Plans which you have created.

subscription-version-3

Once the super admin will tab on Create Plan button after that they will redirect to the next page as below.

subscription-version -add-plan

Here the super admin will add the fields

General Settings

Code

Set the code for the plan

Name

Enter the name of plan

Description

Here super admin can describe about the plan

Plan Limitation

While adding the new plan the super admin will add the plan limitation under the plan limitation section.

subscription-version-5

Allowed Product: Enter the number of product allowed in a specific plan.

Allowed Categories: Enter the number of categories allowed.

Allowed Attributes: Mention the allowed attribute’s number.

Allowed Attributes Family: Enter the number of attributes family.

Allowed Channels: Number of channels tenant can manage: Enter Here.

Allowed Orders: Mention the number of orders for a plan.

Billing Amount

While adding the new plan the super admin can add the billing amount for the plan under the billing amount section.

subscription-version-6

Monthly Amount: Mention the monthly amount.

Yearly Amount (Month by Month): Enter the monthly amount for the year.

Offers

While adding the new plan the super admin can add the offers available for the plan under the offers section.

Status: The super admin can active or inactive the offer option.

Title: Enter the title name for the offer.

Type: Select the type of offer to the fixed or in percentage.

Discount: Enter the discount price or percentage according to the selected type for the offer.

Purchased Plan

Next we move to the another subsection Purchased Plan here the super admin will find list of all purchase plans.

Also, the super admin will find some information like Plan, Company Name, Amount, and all you can see in the below snapshot.

admin-view-purchased-plans

Apart from this, the super admin can also check the detail information about the purchased plan by just hitting eye icon under the action section:

subscription-version-8

Invoices

Under this subsection the super admin will find all the Invoices of their sold plans.

Also, they will find information like customer email, customer name, total and other. They can also lookout the detailed information by hitting the eye icon under action.

admin-subscription-invoice

Tenant – eCommerce Subscription Extension

After the tenant register with the SaaS, they will find the below pop-up at their dashboard for purchase the plan.

tenant-front-view

Moreover, once the tenant will click on the Choose Plan button they will find the super admin subscriptions plan Overview Tab as displayed in the below snapshot.

subscription-version-10

After an overview of all the information about the subscription plan, the tenants can click on the Plans tab to check all the plans added by the super admin with available offers.

subscription-version-10

Now tenants can choose the plan as per their need then they will click on the purchase button to buy the plan.

tenant-checkout

Payment Information

Plan : Choose the plan

Billing Cycle : Select the billing cycle from drop-down

TIN : Enter the TIN number (tax payer identification number)

tenant-checkout-billing-address-settings

First Name: Enter the first name

Last Name: Enter the last name

Email: Mention the email id

Address: Enter the address

Country: Select the county

State: Select the state

After filling in all the billing address detail the tenant will click on the purchase button to make the payment.

If Super Admin Select Stripe Payment Gateway

Then, the tenant will be redirected to the Stripe Payment Gateway Page, here the tenant will sign in with their credentials then they will complete the payment.

stripe-payment-gateway-page

here, you have to fill all the detail and hit the subscribe button. After purchasing the plan, the tenant receives an email.

On the Stripe dashboard, the superadmin can also view the subscription details.

stripe-dashboard

After the payment is successful, an invoice will be generated.

tenant-2-invoice

If Super Admin Select Paypal Payment Gateway

Then, the tenant will be redirected to the PayPal Payment Gateway Page, here the tenant will sign in with their credentials then they will complete the payment

paypal-login

Furthermore, the tenant can view the invoice list of their purchased plans as shown in the below image.

admin-invoice-view

That’s all for Laravel eCommerce SaaS Subscription Module Still, have any query regarding subscription management plugin please feel free to add a ticket at https://bagisto.uvdesk.com/en/

Current Product Version - 2.1.2

Supported Framework Version - Bagisto v2.1.2

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • mansour
    • Prachi Chauhan (Moderator)
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home

    Table of Content