Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Best Alternative of Laravel Spark with Stripe/Paddle

You want the control centre of your subscription logic (plans, user status, features, invoicing rules) to be inside your core Laravel application, using PayPal and Paytm purely as external payment processors.

This is a valid approach, often chosen for greater flexibility or when dealing with payment gateways not supported by tools like Cashier/Spark. However, it does mean you’ll be responsible for building more of the logic yourself.

Laravel Spark is not suitable for this, as its primary value comes from its tight integration with Cashier (Stripe/Paddle) and handling much of the billing logic via those providers.

Here’s a suggested approach using Laravel libraries to speed up development while keeping core logic in-house:

1. Core Subscription Management (In-House Logic)

  • Goal: Manage plans, features, user subscription status, trial periods, and renewals within your application’s database and logic.
  • Approach: You’ll need Eloquent models for Plan, Feature, Subscription (linking User to Plan, storing status, trial end, next billing date, etc.), maybe SubscriptionUsage for metered billing.
  • Libraries to Help:
    • webaune/laravel-subscriptions: This package looks like a strong candidate. Its description explicitly states “Payments are out of scope for this package”. It focuses on providing the database structure (migrations) and Eloquent models/traits for managing plans, features, and subscriptions within your Laravel application itself. This aligns perfectly with your goal of keeping the core logic internal.
    • Custom Build: You can always build these models and the associated logic (checking isActive(), isOnTrial(), canUseFeature(), handling renewals) yourself using standard Laravel practices. webaune/laravel-subscriptions just gives you a head start.

2. Invoice Generation (In-House Logic)

  • Goal: Generate PDF invoices based on your internal subscription data when a payment is confirmed or a billing cycle renews. Store or allow download of these PDFs.
  • Approach: Use a dedicated Laravel PDF generation package combined with your internal subscription data.
  • Libraries to Help:
    • laraveldaily/laravel-invoices: A popular and robust package specifically for creating customizable PDF invoices. You feed it data (buyer info, items, prices, taxes from your models), and it generates the PDF.
    • elegantly/laravel-invoices: A newer, well-regarded alternative that also focuses on generating PDFs from Eloquent data and includes database storage for invoice records.
    • Base PDF Packages: You could use lower-level packages like barryvdh/laravel-dompdf or spatie/laravel-pdf and create the HTML invoice template yourself, but the dedicated invoice packages provide more structure.

3. PayPal Integration (Payment Processing Only)

  • Goal: Initiate payments (one-time or recurring setup), securely handle redirects/callbacks, and listen for webhook notifications (e.g., PAYMENT.SALE.COMPLETED, BILLING.SUBSCRIPTION.ACTIVATED, PAYMENT.CAPTURE.COMPLETED).
  • Approach: Use a reliable PayPal SDK wrapper for Laravel.
  • Libraries to Help:
    • srmklive/paypal: This is a widely used and generally well-maintained package for integrating PayPal into Laravel. It simplifies interacting with the PayPal REST API (getting tokens, creating orders, capturing payments, setting up subscriptions) and handling IPN/Webhooks compared to using the raw PayPal PHP SDK directly. This is likely your best option for accelerating PayPal integration.

4. Paytm Integration (Payment Processing Only)

  • Goal: Initiate payments (supporting methods like UPI, cards, NetBanking, including recurring mandates like UPI Autopay/eNACH), handle callbacks, and process webhook notifications.
  • Approach: Use the official Paytm SDK or a trusted Laravel wrapper.
  • Libraries to Help:
    • Official paytm/paytm-pg SDK: Use the official SDK provided by Paytm. This gives you the most direct control but requires more manual setup within your Laravel app.
    • anandsiddharth/laravel-paytm-wallet: This third-party package was specifically mentioned in a tutorial regarding Paytm subscriptions in Laravel. You’ll need to assess its current maintenance status and compatibility with the latest Laravel versions and Paytm APIs. If it’s up-to-date, it could save significant time. Evaluate this first.

Putting It All Together (The Workflow):

  1. Define Plans/Features: Use your internal models (possibly assisted by webaune/laravel-subscriptions) to define subscription plans and their associated features in your database.
  2. User Subscribes:
    • User selects a plan in your UI.
    • Create a Subscription record in your database (using your internal models/package) with a status like pending or initiating.
    • Based on the user’s chosen gateway (PayPal/Paytm), call the appropriate package (srmklive/paypal or Paytm package) to initiate the payment/subscription setup on the gateway’s side.
    • Redirect the user to PayPal/Paytm to authorize the payment/mandate.
  3. Handle Gateway Callbacks/Redirects: User returns to your site. Show a pending/success/failure message. The real confirmation often comes via webhook.
  4. Handle Gateway Webhooks:
    • Create dedicated webhook controllers/routes for PayPal and Paytm.
    • Verify the incoming webhook authenticity.
    • When a successful payment/activation webhook arrives:
      • Find the corresponding internal Subscription record.
      • Update its status to active.
      • Set the trial_ends_at, starts_at, ends_at (next billing date) based on the plan and payment confirmation.
      • Store relevant gateway subscription IDs (e.g., PayPal Subscription ID) on your internal Subscription model for reference (e.g., for cancellations).
      • Trigger invoice generation using your chosen invoicing package (laraveldaily/laravel-invoices or elegantly/laravel-invoices), feeding it data from your internal Subscription and Plan models. Save/store the invoice.
      • Grant the user access to features based on the active subscription.
    • When a renewal payment webhook arrives, update the ends_at date and generate a new invoice.
    • Handle failure/cancellation webhooks by updating the internal Subscription status accordingly (e.g., past_due, cancelled) and potentially revoking feature access after any grace period.
  5. Manage Subscription Changes (Cancel, Swap):
    • Provide UI for users to manage their subscriptions.
    • When a user cancels: Update the internal Subscription status (e.g., set ends_at to the end of the current paid period, mark as cancelling). Call the gateway API (via srmklive/paypal or Paytm package) to cancel the recurring payment on their end.
    • Swapping plans involves more complex logic: potentially cancelling the old gateway subscription, creating a new one, calculating proration (if needed – this logic would be yours to implement), and updating the internal Subscription record.

Summary of Suggested Libraries:

  • Core Subscriptions: webaune/laravel-subscriptions (or custom Eloquent models)
  • Invoicing: laraveldaily/laravel-invoices or elegantly/laravel-invoices
  • PayPal: srmklive/paypal
  • Paytm: anandsiddharth/laravel-paytm-wallet (evaluate first) or official paytm/paytm-pg SDK

This approach gives you the desired control over the core logic while leveraging specialized packages to handle the complex and time-consuming parts of PDF generation and payment gateway API interactions. It requires more development effort than Spark but precisely meets your requirement of keeping the subscription business logic “in-house”.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Team Foundation Server 2015 Installation Guide (SQL Express + Update 3)

Install Team Foundation Server 2015 using the original Microsoft download paths, with clear guidance for online, offline, and ISO-based setup. This revised guide also includes an installation workflow, command example, and practical pitfalls to avoid.

Read More

How to Access a Running Docker Container Shell: docker exec vs docker attach

Need a shell inside a running container that is already in detached mode? This updated guide shows the correct workflow, compares docker exec and docker attach, and explains when SSH does and does not make sense.

Read More

Host Your Own NuGet Feed: Local Source vs NuGet.Server vs NuGetGallery

Learn how to host a private NuGet feed using three practical approaches: a local folder source, NuGet.Server, and NuGetGallery. This revised guide includes setup steps, command examples, and a workflow diagram to help you choose the right model.

Read More

Publish NuGet Packages to NuGet.org: CLI Steps, Workflow, and CI Example

Learn how to publish a NuGet package to NuGet.org using either nuget.exe or the dotnet CLI. This revised guide includes a workflow diagram, command comparison, and a CI-friendly example.

Read More

How to Create NuGet Packages with nuget.exe (Assembly, .nuspec, and .csproj Methods)

Learn three practical ways to build NuGet packages using nuget.exe: from an existing assembly, from a convention-based folder layout, or directly from a Visual Studio project. This guide includes commands, folder conventions, token behavior, and common pitfalls.

Read More

Virtualization in DevOps: Using Vagrant, Docker, and Cloud Platforms Together

This guide explains how VM-based workflows, containers, and cloud platforms complement each other in DevOps. It includes a practical workflow, trade-off table, and command examples for day-to-day use.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x