Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

lemon-squeezy

БесплатноБез исполняемых скриптовНе проверен

Lemon Squeezy is a payments platform that acts as Merchant of Record for software, subscriptions and digital products, handling VAT and sales tax, invoices…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Lemon Squeezy

Overview

Lemon Squeezy is the seller of record for your sales: it collects and remits VAT and sales tax, issues invoices, runs fraud checks, hosts the checkout and a customer portal, and pays you out. You integrate through a JSON:API REST API (https://api.lemonsqueezy.com/v1), the official SDK @lemonsqueezy/lemonsqueezy.js (4.x, Node 20+), and signed webhooks. License keys have their own unauthenticated License API.

Server-side only: the API key gives full access to your stores, so never ship the SDK to the browser.

Instructions

  1. Install and create a key in Settings > API (keys made in test mode only touch test data):
npm install @lemonsqueezy/lemonsqueezy.js
  1. Call lemonSqueezySetup({ apiKey: process.env.LEMONSQUEEZY_API_KEY }) once at startup.
  2. Every SDK call resolves to { statusCode, error, data } and does not throw on API errors. data is the raw JSON:API body, so the resource is at data.data and its fields at data.data.attributes. Check error first.
  3. createCheckout(storeId, variantId, options) takes the store and variant IDs as positional arguments, then checkoutData, checkoutOptions, productOptions, testMode, expiresAt. Put your own user ID in checkoutData.custom. enabledVariants is an array of numeric variant IDs. The dark checkout option is deprecated; use the colour options.
  4. Webhooks: create one in the dashboard (or createWebhook) with a signing secret and the events you need. At minimum order_created, subscription_created, subscription_updated, subscription_payment_success; add license_key_created for license keys. Lemon Squeezy POSTs JSON with X-Event-Name and X-Signature headers and expects a 200; otherwise it retries up to three more times with exponential backoff.
  5. Verify X-Signature as the HMAC-SHA256 hex digest of the raw request body (not re-serialised JSON), compared with crypto.timingSafeEqual.
  6. Event name is meta.event_name; your checkout custom data arrives in meta.custom_data; the resource is data (data.id, data.attributes). Subscription status values: on_trial, active, paused, past_due, unpaid, cancelled, expired.
  7. License API (activateLicense, validateLicense, deactivateLicense) needs no API key, so it is safe to call from a desktop app. Activation returns an instance.id to store and pass to later validations.

Examples

Checkout link for a signed-in user

import { lemonSqueezySetup, createCheckout } from "@lemonsqueezy/lemonsqueezy.js";

lemonSqueezySetup({ apiKey: process.env.LEMONSQUEEZY_API_KEY! });

export async function proCheckoutUrl(userId: string, email: string) {
  const { data, error } = await createCheckout(
    process.env.LEMONSQUEEZY_STORE_ID!,
    process.env.LEMONSQUEEZY_PRO_VARIANT_ID!,
    {
      checkoutData: { email, custom: { user_id: userId } },
      productOptions: { redirectUrl: "https://app.northwind.dev/billing/success" },
    },
  );
  if (error) throw new Error(`Checkout failed: ${error.message}`);
  return data.data.attributes.url; // redirect the browser here
}

Result: a hosted checkout URL like https://northwind.lemonsqueezy.com/checkout/custom/....

Webhook endpoint (Express)

import crypto from "node:crypto";
import express from "express";

const app = express();

app.post("/api/webhooks/lemonsqueezy", express.raw({ type: "application/json" }), async (req, res) => {
  const digest = Buffer.from(
    crypto.createHmac("sha256", process.env.LEMONSQUEEZY_WEBHOOK_SECRET!).update(req.body).digest("hex"),
    "utf8",
  );
  const signature = Buffer.from(req.get("X-Signature") ?? "", "utf8");
  if (digest.length !== signature.length || !crypto.timingSafeEqual(digest, signature)) {
    return res.status(401).json({ error: "Invalid signature" });
  }

  const payload = JSON.parse(req.body.toString("utf8"));
  const { event_name, custom_data } = payload.meta;
  const { id, attributes } = payload.data;

  switch (event_name) {
    case "subscription_created":
    case "subscription_updated":
      await db.users.update(custom_data?.user_id, {
        lemonSubscriptionId: id,
        subscriptionStatus: attributes.status,
        renewsAt: attributes.renews_at,
        endsAt: attributes.ends_at,
      });
      break;
    case "license_key_created":
      await db.licenses.create({ key: attributes.key, userId: custom_data?.user_id });
      break;
  }
  res.json({ received: true });
});

Result: curl with a wrong signature gets 401; a real subscription_created updates the user and returns {"received":true}.

Activate and validate a license in a desktop app

import os from "node:os";
import { activateLicense, validateLicense } from "@lemonsqueezy/lemonsqueezy.js";

const key = "38b1460a-5104-4067-a91d-77b872934d51";

const { data: act } = await activateLicense(key, `${os.hostname()}-${os.platform()}`);
if (!act?.activated) throw new Error(act?.erro
Полный SKILL.md на GitHub

Установить lemon-squeezy в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл lemon-squeezy?

Lemon Squeezy is a payments platform that acts as Merchant of Record for software, subscriptions and digital products, handling VAT and sales tax, invoices, license keys and a customer portal for you. Use this skill to create checkouts with the @lemonsqueezy/lemonsqueezy.js SDK, verify webhook signatures, track subscription status, or validate and activate license keys for a desktop app or CLI.

Как установить скилл lemon-squeezy?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл lemon-squeezy запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить lemon-squeezy с