Moving license-key checks off the Lemon Squeezy License API before 31 March 2027
On 16 November 2026, Lemon Squeezy published Saying goodbye to Lemon Squeezy. The official wording is that the product is winding down, new store sign-ups are already closed, and "Lemon Squeezy will stop processing payme
On 16 November 2026, Lemon Squeezy published Saying goodbye to Lemon Squeezy. The official wording is that the product is winding down, new store sign-ups are already closed, and "Lemon Squeezy will stop processing payments on March 31, 2027." The migration guide says the same about transactions, including subscription renewals, and that the deadline will not be extended. Their recommended latest start is mid-January 2027.
If you only used Lemon Squeezy for checkout and tax, the path they point to is Stripe Managed Payments. That may be enough for you.
If your desktop app, plugin, CLI, or extension calls the Lemon Squeezy License API today, you have a second problem that checkout migration does not solve.
License keys are not in Managed Payments
This is not a claim about every Stripe product. It is specific to Managed Payments, the replacement Lemon Squeezy recommends.
Their comparison table lists "Digital fulfillment and license keys" as included on Lemon Squeezy and not included on Managed Payments: "Connect a fulfillment or licensing app, or build your own integration."
The fulfillment guide is blunter:
Managed Payments doesn't deliver files, download links, or license keys.
And:
If you do not complete the migration by then, customers may lose access to their license keys, files, and links after March 31, 2027.
Nothing changes for customers until that date. The work is to have somewhere else for those checks to go, and for the keys people already typed into your app to still be accepted.
What the License API actually is
The License API is a small, separate API from the rest of Lemon Squeezy. Apps talk to it with form-encoded POST requests, not JSON:API, and they do not send a Bearer token. There are three routes:
-
POST /v1/licenses/activateรขโฌโlicense_keyandinstance_name -
POST /v1/licenses/validateรขโฌโlicense_key, and optionallyinstance_id -
POST /v1/licenses/deactivateรขโฌโlicense_keyandinstance_id
A typical activate looks like this:
curl -X POST https://api.lemonsqueezy.com/v1/licenses/activate \
-H "Accept: application/json" \
-d "license_key=38b1460a-5104-4067-a91d-77b872934d51" \
-d "instance_name=office-mac"
The response is JSON. You get activated, valid, or deactivated, an error field (null on success), a license_key object, an instance when that route has one, and a meta object with store, product, and customer fields. Timestamps look like 2021-01-24T14:15:07.000000Z. Status is one of inactive (valid, no activations yet), active, expired, or disabled. A null activation_limit means unlimited.
If your app already stored instance.id from activate, that value matters. Validate and deactivate use it. A migration that issues a brand-new key, or a new instance id, means a shipped client has to be updated and every customer has to activate again.
The published rate limit is 60 requests per minute.
Two ways out
I have seen two honest families of exits.
The first is to adopt another vendor's license API. Several merchant-of-record products now issue keys, including Polar, Creem, and Dodo Payments. That can be the right move if you want checkout and licensing from the same company. Read their current docs. In the ones I checked, the request shape is theirs, and some of them issue new keys rather than keeping the Lemon Squeezy key string. If your app hard-coded https://api.lemonsqueezy.com and stored instance ids, you will be changing more than a host name, and you may be asking customers to paste a new key.
The second is to run a license server yourself that answers the same three routes, import the keys and instances you already sold, and point the app at your host:
- const base = "https://api.lemonsqueezy.com";
+ const base = "https://licenses.yourdomain.com";
You still need a payment provider for new sales. The license server is only the check.
I took the second path, on Cloudflare Workers and D1, because the check is a small POST, the data should sit in the seller's account rather than mine, and the free Workers and D1 allowance is enough for many indie apps. That allowance is Cloudflare's, and it changes, so read the current limits before you promise a volume.
The rest of this post is how I built that, including the parts that are easy to get wrong. You can implement it yourself. Near the end I will say what I shipped.
Import the keys you already sold, first
Pull /v1/license-keys, /v1/license-key-instances, and /v1/order-items from the Lemon Squeezy API and write a SQL seed your database can load.
Keep the key string exactly as it is. Keep the instance identifier as instance.id, because that is what the License API returns and what a shipped app may already have stored.
One detail that is easy to miss: instances_count on a key can be higher than the instance rows you actually receive. If you ignore that, a later activate can go over the real usage. I store the difference as an offset and add it to the local instance count when I check the activation limit.
Load that seed into an empty database before you mint any new keys. Lemon Squeezy's license_key.id is a number, and if you also use numeric ids, a re-import after you have already issued keys can collide.
Keep the response shape boring
Compatibility here means the JSON keys and types already in your app. If you return activation_limit as a string, or a timestamp without the six-digit fractional seconds, something will break in a client you cannot quickly patch.
I recorded the public examples for activate, the activation-limit error, validate with and without an instance, and deactivate, and I test that the same keys and value types come back. Those tests do not call live Lemon Squeezy. They only check that the shape I serve still matches the documented examples.
Error status codes are part of that shape. Missing fields are 422. An unknown key is 404. A known key that cannot be used รขโฌโ expired, disabled, over the activation limit, or a bad instance รขโฌโ is 400, and the body still includes error plus the license when I have it. The documented activation-limit message is: This license key has reached the activation limit.
New sales are a webhook, not a checkout
A self-hosted license server should not take the customer's money. New keys get minted when a signed webhook says the payment succeeded: Stripe checkout.session.completed and checkout.session.async_payment_succeeded, and the equivalent paid events from Creem, Dodo, or Paddle.
Put product_name, activation_limit, and license_days in the provider metadata when you want those values. Otherwise you will mint every key with the same defaults.
A few limits I left in on purpose, or ran into and kept:
The worker does not email the customer. Read the minted key from the webhook response or an admin list, and send it yourself.
Duplicate deliveries of the same event id should not mint twice.
Refund handling is only as good as the webhook shapes you implement. I handle a handful of refund events that carry an id I stored, and I ignore the rest.
Subscription-cancelled events should expire the key, not delete it, so a later validate can return expired instead of "not found."
Provider product ids that are not integers get stored as 0 in meta.product_id, because that field is a number in the License API. Keep the name.
Paddle often omits the customer email unless you add it in custom_data or include sensitive fields. The license can still be minted with an empty email.
I also added a pass-through window. Until a date you set, a key the database has never seen is forwarded to https://api.lemonsqueezy.com and cached. After that date, unknown keys are 404. Imported keys never take that trip. The catch: pass-through cannot deactivate an instance it never saw, so this is a bridge, not a substitute for a real import.
The check is online; offline is the app's problem
The validate call needs the network. A laptop on a plane should not lock a paying customer because DNS failed.
The worker does not issue a signed offline license. What I tell people to do in the app is simpler: store the last successful validate response and the instance.id from activate. If a later check fails because the device is offline, the request timed out, or the server returned a 5xx, keep the last valid result for a window you choose. Seven days is a reasonable start for a desktop app. If the response is a 4xx that says the key is expired, disabled, unknown, or over its limit, lock immediately. A network error is not an invalid key. Do not call validate on every click.
Rate limits and other sharp edges
Lemon Squeezy's published limit is 60 requests per minute. I used the same default, as a D1 counter per IP per minute. Two requests at the same moment can both pass. If you need a hard ceiling, this is not it.
There is no customer portal and no admin dashboard in what I shipped. Admin is a CLI that can list keys, disable one, or reset its activations.
Cloudflare has to be there. If you outgrow the free allowance, that bill is yours.
What I shipped
I built a product around this approach, called Keyharbor. It is a self-hosted license server you deploy on your own Cloudflare account. The docs cover the routes, the import, the webhooks, and the pass-through cutoff. I am a solo founder in Brazil. It is a one-time purchase, US$29 at launch, later US$49, with a 14-day refund on the download. I am not affiliated with Lemon Squeezy or Stripe, and I am not a merchant of record.
I do not have sales or a waitlist to wave at you, and I will not invent any. The download includes 19 tests, including the shape checks against the public examples. v1 has the limits I already listed: no license email, no dashboard, no signed offline license, and a rate limiter that is not perfectly atomic.
If you already validate against Lemon Squeezy and you see a hole in this approach, I want to hear it: [email protected]
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.