LemonSqueezy Integration for SaaS Subscriptions

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    848
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

LemonSqueezy Integration for SaaS Subscriptions

LemonSqueezy is Merchant of Record platform, Paddle analog, but targeted at indie developers and small SaaS products. Takes care of taxes, refunds, fraud detection. Suitable for early-stage products without resources for full billing. Commission — 5% + 50¢ on free plan, 3.5% + 30¢ on Lemon.js Plus.

Integration takes 1–3 working days.

SDK and Setup

LemonSqueezy provides official SDKs for JavaScript/TypeScript and PHP:

npm install @lemonsqueezy/lemonsqueezy.js
composer require lmsqueezy/laravel

Laravel package (lmsqueezy/laravel) adds Billable trait to User model, similar to Laravel Cashier:

use LemonSqueezy\Laravel\Billable;

class User extends Authenticatable
{
    use Billable;
}

Creating Variant for Subscription

In LemonSqueezy product → variant (analogous to Price in Stripe). Variants created in dashboard. For subscription billing interval and trial period specified.

Checkout

// Generate checkout URL
$checkout = $user->checkout('variant_id_here', [
    'checkout_options' => [
        'dark'           => true,
        'button_color'   => '#7C3AED',
        'subscription_preview' => true,
    ],
    'checkout_data'    => [
        'email'       => $user->email,
        'name'        => $user->name,
        'custom'      => ['user_id' => $user->id],
    ],
    'expires_at'       => now()->addHours(24)->toIso8601String(),
]);

return redirect($checkout->url);

Checkout opens as overlay or separate page on checkout.lemonsqueezy.com. Custom domain only on paid plan.

Webhook

// routes/web.php
Route::lemonSqueezyWebhooks('/lemon-squeezy/webhook');

Package automatically verifies signature and dispatches Laravel events:

use LemonSqueezy\Laravel\Events\SubscriptionCreated;
use LemonSqueezy\Laravel\Events\SubscriptionUpdated;
use LemonSqueezy\Laravel\Events\SubscriptionExpired;
use LemonSqueezy\Laravel\Events\OrderRefunded;

class EventServiceProvider extends ServiceProvider
{
    protected $listen = [
        SubscriptionCreated::class => [ActivateUserSubscription::class],
        SubscriptionExpired::class => [DeactivateUserSubscription::class],
        OrderRefunded::class       => [HandleRefund::class],
    ];
}

Activation listener:

class ActivateUserSubscription
{
    public function handle(SubscriptionCreated $event): void
    {
        $userId = $event->subscription->custom_data['user_id'] ?? null;
        if (!$userId) return;

        $user = User::find($userId);
        $user?->update([
            'plan'            => $event->subscription->product_name,
            'subscribed_at'   => now(),
            'subscription_status' => 'active',
        ]);
    }
}

Subscription Management

// Get user subscription
$subscription = $user->subscription();

// Cancel (end of period)
$subscription->cancel();

// Immediate cancellation
$subscription->cancelNow();

// Resume cancelled subscription
$subscription->resume();

// Check status
if ($user->subscribed()) {
    // Active subscription
}

if ($user->onTrial()) {
    $trialEndsAt = $user->trialEndsAt();
}

Customer Portal

LemonSqueezy generates customer portal link:

$portalUrl = $user->customerPortalUrl();
return redirect($portalUrl);

Portal allows changing card, downloading invoices, cancelling subscription. Customization limited.

Licenses (One-Time Products)

LemonSqueezy supports not only subscriptions but license keys for one-time products. On purchase license key generated, can be activated via API:

// Activate license key
$response = Http::withToken(config('lemon-squeezy.api_key'))
    ->post('https://api.lemonsqueezy.com/v1/licenses/activate', [
        'license_key'  => $request->license_key,
        'instance_name'=> $request->app_name,
    ]);

if ($response->json('activated')) {
    $user->update(['license_key' => $request->license_key, 'is_licensed' => true]);
}

Limitations

LemonSqueezy doesn't support metered/usage-based billing — only fixed amounts. For SaaS with consumption-based pricing Stripe Billing or Orb better. Also no B2B invoicing with payment delay. For simple SaaS products with fixed plans — sufficient enough.