MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

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

Top 10 Conversation Intelligence Platforms: Features, Pros, Cons & Comparison

Introduction Conversation Intelligence Platforms are advanced software solutions that capture, transcribe, analyze, and interpret conversations across voice calls, video meetings, and digital interactions. Using AI, natural language…

Read More

9 Best CRM for Manufacturing Companies That Sync with Your ERP

Picture this: your sales team just landed a marquee order, but the shop floor never got the memo. Raw-material bins sit empty, production slots are booked solid,…

Read More

How to see number of emails sent using smtp in laravel

Laravel does not count or log SMTP emails by default, so a grep will only return a real number once your application writes one log line for…

Read More

List of Top Free Open Source & Self Hosted Application for Resource Planning

The three tools listed below are farmOS, grocy and Tania. All three are free, open source and self-hosted, and each one plans resources for a specific area:…

Read More

List of Top Free Open Source & Self Hosted Application for Software Development – Continuous Integration & Deployment

This page lists free, open source CI/CD servers you can host yourself, from long-established tools such as Jenkins, GitLab CI, GoCD and Buildbot to lighter, container-native options…

Read More

List of Top Free Open Source & Self Hosted Application for Knowledge Management Tools

This page lists free, open source knowledge management tools you can host on your own servers: Atomic Server for linked documents and data, and Mindmaps, My Mind…

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