DEV Community

Jan Marc Coloma
Jan Marc Coloma

Posted on

I Built an n8n Community Node for Lemon Squeezy - Here's How to Automate Your Digital Product Sales

Introduction

I recently published my first open-source n8n community node: n8n-nodes-lemonsqueezy - a full integration for Lemon Squeezy, the platform for selling digital products, subscriptions, and software licenses.

In this article, I'll walk you through what it does, why I built it, and how you can use it to automate your digital product business.

What is Lemon Squeezy?

Lemon Squeezy is a merchant of record platform that handles payments, taxes, and compliance for digital creators. It's popular among indie hackers and developers for selling:

  • Digital downloads (eBooks, courses, templates)
  • SaaS subscriptions
  • Software licenses
  • One-time and recurring payments

What is n8n?

n8n is a self-hosted, open-source workflow automation platform. Think Zapier, but you own your data and can extend it with custom nodes.

Why I Built This

I was building a SaaS product and needed to automate several workflows:

  • Send Slack notifications when orders come in
  • Sync customers to my CRM
  • Validate license keys via API
  • Send recovery emails for failed subscription payments

The official Lemon Squeezy API is great, but manually calling it via HTTP nodes was tedious. So I built a proper integration.

Features

Full API Coverage

The node supports 15+ resources with full CRUD operations:

Resource Operations
Checkout Create, Get, Get Many
Customer Create, Update, Delete, Get, Get Many
Order Get, Get Many, Refund
Subscription Get, Get Many, Update, Cancel, Resume
License Key Get, Get Many, Validate, Activate, Deactivate
Discount Create, Delete, Get, Get Many
Product Get, Get Many
Variant Get, Get Many
Webhook Create, Update, Delete, Get, Get Many

Plus: Store, Order Items, Subscription Invoices, License Key Instances, Discount Redemptions, and Usage Records.

Webhook Trigger

Real-time events for everything important:

  • order_created / order_refunded
  • subscription_created / subscription_cancelled / subscription_updated
  • subscription_payment_success / subscription_payment_failed
  • license_key_created / license_key_updated

Security Hardened

Security was a priority:

  • Mandatory webhook signature verification using HMAC-SHA256
  • Replay attack protection - rejects events older than a configurable threshold
  • SSRF protection - blocks internal/private network URLs
  • Input validation - RFC 5322 email validation

Production Ready

  • Built-in rate limiting with automatic retry
  • Exponential backoff for failed requests
  • 87%+ test coverage with 176 tests
  • Full TypeScript support

Installation

Option 1: Community Nodes (Recommended)

  1. Go to Settings > Community Nodes in your n8n instance
  2. Click Install
  3. Enter n8n-nodes-lemonsqueezy
  4. Click Install

Option 2: npm


bash
npm install n8n-nodes-lemonsqueezy
Setting Up Credentials
Log in to your Lemon Squeezy Dashboard
Go to Settings > API
Click Create API Key
Copy the key and add it to n8n credentials
Example Workflows
1. New Order Slack Notification

Lemon Squeezy Trigger (order_created) → Slack (Send Message)
Get instant notifications when someone buys your product.

2. Subscription Churn Prevention

Schedule Trigger (daily) → Lemon Squeezy (Get Subscriptions, status=past_due) → Send Email
Automatically reach out to customers with failed payments before they churn.

3. License Key Validation API

Webhook → Lemon Squeezy (Validate License Key) → Respond to Webhook
Build a license validation endpoint for your desktop or mobile app.

4. Dynamic Checkout Links

HTTP Request → Lemon Squeezy (Create Checkout) → Return Checkout URL
Create personalized checkout links with pre-filled customer data and custom discounts.

5. Customer Sync to CRM

Lemon Squeezy Trigger (order_created) → Lemon Squeezy (Get Customer) → HubSpot (Create Contact)
Keep your CRM in sync automatically.

Advanced Features
Filtering
Most "Get Many" operations support filtering:


Filter by: storeId, status, email, productId, variantId, orderId
Sorting
Sort results by created_at or updated_at in ascending or descending order.

Relationship Expansion
Include related resources in a single API call:


Orders → include: customer, order-items, subscriptions
This reduces API calls and speeds up your workflows.

Technical Details
The node is built with:

TypeScript for type safety
Vitest for testing
ESLint and Prettier for code quality
GitHub Actions for CI/CD
Project Structure

nodes/
  LemonSqueezy/
    LemonSqueezy.node.ts      # Main node
    LemonSqueezyTrigger.node.ts # Webhook trigger
    helpers.ts                 # API helpers
    types.ts                   # TypeScript types
    resources/                 # Resource definitions
credentials/
  LemonSqueezyApi.credentials.ts
test/
  LemonSqueezy.test.ts        # 176 tests
Contributing
The project is open source and contributions are welcome:

GitHub: https://github.com/janmaaarc/n8n-nodes-lemonsqueezy
npm: https://www.npmjs.com/package/n8n-nodes-lemonsqueezy
Feel free to open issues for bugs or feature requests, or submit a PR.

Conclusion
If you're selling digital products with Lemon Squeezy and using n8n for automation, this node should save you a lot of time.

Install it today:


n8n-nodes-lemonsqueezy
Let me know in the comments what workflows you build with it.

Links:

GitHub: https://github.com/janmaaarc/n8n-nodes-lemonsqueezy
npm: https://www.npmjs.com/package/n8n-nodes-lemonsqueezy
Lemon Squeezy API Docs: https://docs.lemonsqueezy.com/api
n8n Community Nodes Docs: https://docs.n8n.io/integrations/community-nodes/
Enter fullscreen mode Exit fullscreen mode

Top comments (0)