# Next.js boilerplate with Lemon Squeezy

> Subscriptions and one-time purchases on Lemon Squeezy, the merchant of record: hosted checkout for monthly, yearly and lifetime prices, the signed customer portal, refunds that revoke access, and X-Signature verified webhooks made idempotent without a delivery id. Plans live in src/lib/pricing.ts and /pricing renders with no keys.

Merchant of record with license keys built in. VAT and sales tax are its problem.

- **Category:** Payments
- **Pricing:** 5% + 50c per transaction, no monthly fee. Non-US payments and PayPal each add 1.5%, and subscriptions add 0.5%. Tax calculation, filing and remittance are included.
- **Best for:** Solo founders and small teams selling SaaS, desktop apps or digital downloads worldwide. You get checkout, tax, license keys and a customer portal on day one, with no VAT registration anywhere. Strong fit for software sold with license keys, because Lemon Squeezy issues and validates them itself.
- **Requires:** database, auth
- **Conflicts with:** stripe, polar, dodo
- **Vendor docs:** https://docs.lemonsqueezy.com/api

## Trade-offs

- Lemon Squeezy is the seller on the statement and the invoice. Tax liability moves to it, which is the point. Your brand is not what the customer sees on their card line.
- The base rate, 5% + 50c, is above Dodo's 4% + 40c and matches Polar's free plan. Run the numbers against both before you launch.
- Owned by Stripe since 2024. In January 2026 it said its goal is an easy migration to Stripe Managed Payments. Read that plan before you build on it.
- The API cannot create products or prices. You create the variants in the dashboard; `billing:sync-plans` checks them against src/lib/pricing.ts and finds their ids for you.
- Webhooks carry no delivery id and retry only three times (5s, 25s, 125s). A handler that is down for three minutes loses events, so a nightly reconcile from the API ships with it.

## Known fixes it ships

- [Idempotent Lemon Squeezy webhooks when there is no delivery id](https://agenticboilerplate.com/cookbook/lemonsqueezy/idempotent-webhooks-without-a-delivery-id): Lemon Squeezy signs the raw body with X-Signature, sends no event id, and retries three times. Build your own idempotency key, verify in constant time, and know what to re-read.
- [Lemon Squeezy license keys for desktop apps, CLIs and plugins](https://agenticboilerplate.com/cookbook/lemonsqueezy/license-keys): Turn on license keys per variant, activate and validate from the client with the public License API, and tie key expiry to the subscription. What to cache and what never to ship.
- [What "merchant of record" means for your taxes on Lemon Squeezy](https://agenticboilerplate.com/cookbook/lemonsqueezy/merchant-of-record-tax): Lemon Squeezy sells to your customer and you sell to Lemon Squeezy. What that moves off your plate, what it does not, and how to show prices honestly.
- [One-time purchases on Lemon Squeezy, from lifetime deal to refund](https://agenticboilerplate.com/cookbook/lemonsqueezy/one-time-purchases-with-lemon-squeezy): A lifetime deal is a single-payment variant, and order_created fires for subscriptions too. How to tell them apart, find the buyer, show the purchase, and take access back on a refund.
- [Lemon Squeezy orders, invoices and partial refunds, and what each does to access](https://agenticboilerplate.com/cookbook/lemonsqueezy/orders-invoices-and-partial-refunds): The first payment arrives as an order and an invoice, refunded_amount is a running total, and chargebacks send no event. How to record each once and revoke access on the right one.
- [Recovering from missed Lemon Squeezy webhooks](https://agenticboilerplate.com/cookbook/lemonsqueezy/recovering-from-missed-webhooks): Three retries over about two and a half minutes, then the event is gone. A nightly reconcile from the API, what it can and cannot rebuild, and how to fix the rows it cannot.
- [The Lemon Squeezy subscription state machine, and who keeps access](https://agenticboilerplate.com/cookbook/lemonsqueezy/subscription-states-and-access): on_trial, active, past_due, unpaid, paused, cancelled, expired. Which unlock your product, how to normalize them, and the two states people get wrong.
- [Moving a Lemon Squeezy integration from test mode to live mode](https://agenticboilerplate.com/cookbook/lemonsqueezy/test-mode-to-live-mode): Test and live are separate worlds with separate keys, webhooks and variant ids. The checklist, and the silent mismatch that sells nothing.

## Generate it

[Build a repo with Lemon Squeezy](https://agenticboilerplate.com/build?b=lemonsqueezy)

---

Agentic Boilerplate: A Next.js repo your agent already knows. Free during launch, then $99 once.

- Site map for agents: https://agenticboilerplate.com/llms.txt
- Public API: https://agenticboilerplate.com/openapi.json
- Contact: agenticstudio@gmail.com
