AddThisFeature

Lemon Squeezy License Sync

Sync Lemon Squeezy orders and license keys into the app's entitlement state.

involved Payments & Finance

What it adds

A verified event pipeline mapping Lemon Squeezy orders, subscriptions, and license keys onto local entitlements, with activation limits and revocation handled.

What your agent is told to do

5
  1. 1

    Verify the authenticity of every incoming provider event before it changes anything. An unverified purchase notification is a request from the internet to give away your product.

  2. 2

    Keep an explicit server-side table mapping each purchasable variant to the entitlement it grants. Do not infer the plan from a product name, because names get edited for marketing reasons and entitlements should not move when they do.

  3. 3

    Bind each license key to a single account on first activation and refuse to activate it against a different one afterwards, with a documented path for an operator to release a key that genuinely needs to move.

  4. 4

    Track activations against the key's own limit, and treat deactivation as returning a slot rather than deleting the record, so an audit can show where a key has been used.

  5. 5

    Entitlement must live in the same local access record any other billing brief writes to. If a Stripe or Paddle brief is also applied, this one adds a source, it does not add a second source of truth.

Edge cases it handles

8
  • Events arriving without a valid signature must be rejected outright, and rejections logged. Nothing is activated on the strength of an unverified message.
  • Variants and products map to entitlements through explicit server-side configuration. An unrecognised variant must park the order for an operator rather than defaulting to some plan, and a mapping change must not silently upgrade existing customers.
  • Activation limits, deactivations, expiry, and refunded or charged-back orders all have to revoke or restore access correctly. A refund that leaves the license working is a hole; a refund that also deletes the customer's data is worse.
  • Provider deliveries are retried. Record processed event identifiers and make handlers repeat-safe, or a retry will grant a second seat or send a second receipt.
  • A license key must not attach to an unrelated account. Bind on first activation, reject mismatches, and require an explicit operator action with a record of who did it to reassign one.
  • Out-of-order delivery means a cancellation can arrive before the renewal that supersedes it. Compare against a stored sequence or timestamp and ignore anything older than current state.
  • When the provider is unreachable, previously activated licenses must keep working. Offline validation should fall back to the last known good state with a grace period rather than locking paying users out.
  • Never expose the provider credential or the raw license key in client-visible code, and show keys to the owner only, masked until deliberately revealed.

Definition of done

9
  • Unsigned or unverifiable events are rejected and logged, and change no state.
  • Variants map to entitlements through explicit server configuration, and unknown variants are quarantined.
  • Activation limits are enforced, deactivation returns a slot, and the activation history is retained.
  • Refunds, expiry, and cancellations revoke access without destroying the customer's data.
  • Retried and out-of-order deliveries leave entitlement state correct.
  • A license key is bound to one account and can be reassigned only by a recorded operator action.
  • Provider unavailability leaves existing licenses working within a defined grace period.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.