IntelliFin Field Notes
Payments & Edge Engineering

Migrating from Lemon Squeezy to Stripe Without Breaking Customer Licenses

By Xiaolei Lu Updated 2026-12-02 ~6 min read

Backend billing migrations look clean on a whiteboard until you remember you have compiled binaries, Chrome extensions, or Raycast plugins already sitting on customer laptops calling https://api.lemonsqueezy.com/v1/licenses/*.

Lemon Squeezy announced its wind-down (payments ending March 31, 2027) alongside an official transition path into Stripe Managed Payments. When engineering teams inspect that transition, they quickly hit an unexpected contract break: Stripe Managed Payments does not provide a native drop-in replacement for Lemon Squeezy's /v1/licenses/activate, /validate, and /deactivate schema.

If you rip out your existing activation code and ship a brand-new payment SDK inside your next desktop or browser release, two ugly things happen immediately:

Comparison between hardcoded Lemon Squeezy client license endpoints and a 1-line Cloudflare Worker + KV edge bridge
Keeping the exact /v1/licenses/* wire contract at the edge avoids breaking installed client versions.

1. Inspecting What Installed Builds Expect Over the Wire

Before rewriting any client code, capture the exact HTTP contract your installed software expects. Standard Lemon Squeezy client integrations send application/x-www-form-urlencoded bodies (or JSON) against three endpoints:

Clients deserialize nested fields such as activated, valid, deactivated, license_key.activation_limit, license_key.activation_usage, instance.id (UUID), and meta. When usage returns to 0 after deactivation, status must drop back to inactive. Change a single key name or HTTP status code and legacy software locks paying buyers out.

2. Bridging the Contract at the Edge With Cloudflare Workers + KV

Because we already maintained a Worker + KV license gateway for our own Chrome extensions, preserving backward compatibility took roughly ~350 lines of TypeScript without touching client validation logic:

// Only the host string changes in future client builds (or point custom DNS):
const LICENSE_API = "https://your-worker.workers.dev";
// Previously: "https://api.lemonsqueezy.com"

const res = await fetch(`${LICENSE_API}/v1/licenses/activate`, {
  method: "POST",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/x-www-form-urlencoded",
  },
  body: new URLSearchParams({
    license_key: key,
    instance_name: deviceName,
  }),
});
  1. Bulk-seed existing keys from CSV: Export active keys from Lemon Squeezy (Licenses -> Export CSV) and load them directly into Cloudflare LICENSES_KV under ls_license:<key>. Bulk KV uploads handle 50,000+ records in seconds so existing customers never re-enter keys.
  2. Verify webhooks with raw bytes & Web Crypto: Whether checkout runs on Stripe Direct, Polar.sh, or Paddle, verify incoming webhooks via constant-time HMAC-SHA256 (crypto.subtle) on the unparsed raw request body, never after framework middleware re-serializes JSON.
  3. Key minting idempotency by event ID: Store issuance state keyed strictly to event.id / checkout.session.id so webhook retries become safe no-ops, and auto-disable keys on refunds or chargebacks.
Try the live wire contract directly: Test the free browser-local interactive /v1/licenses/* sandbox & offline CSV auditor (MIT) immediately with zero signup, or inspect SqueezyBridge (self-hosted Cloudflare Worker repo kit at $39 once, or managed gateway at $12/mo) to hit POST /demo/v1/licenses/activate before changing a line of code.

3. Preventing Silent Checkout Regressions During Cutover

Swapping payment webhooks rarely breaks loudly with clean 500 alerts. Instead, a redirect drops a query parameter, an announcement bar CSS z-index covers the checkout button on mobile Safari, or webhook verification fails quietly while every unit test stays green.

Before flipping production billing traffic, commit five plain TypeScript Playwright end-to-end traces directly inside your own GitHub Actions repo covering Cart / Checkout -> Promo -> Webhook HMAC -> License Minting. Keeping the test suite in your repository ensures zero vendor lock-in even if you pause outside tooling later. If you are mid-migration and want those five regression gates or continuous 6-hour checkout checks wired in fast, see our open-repo setup notes at StoreGuard & FlowQA.

4. Keeping Browser Tooling Lean (Without $99/mo Tax Bloat)

Part of the same engineering discipline pushed us to strip recurring SaaS overhead out of small single-purpose tools too. Alongside our license bridge, we shipped two public single-purpose Chrome extensions on a one-time $29 lifetime license (with free 20-row CSV/JSON previews on the Chrome Web Store):