Creator
Billing

Lemon Squeezy

Lemon Squeezy integration for checkout and subscription management.

Setup

  1. Create a Lemon Squeezy account at lemonsqueezy.com
  2. Create a store and products
  3. Set environment variables:
LEMONSQUEEZY_API_KEY=""
LEMONSQUEEZY_STORE_ID=""
LEMONSQUEEZY_WEBHOOK_SECRET=""
  1. Copy variant IDs to config/billing.config.ts

Lemon Squeezy uses the REST API directly — no SDK dependency required.

API routes

RouteMethodPurpose
/api/lemonsqueezy/checkoutPOSTCreate a checkout session
/api/lemonsqueezy/webhookPOSTHandle webhook events

Webhook setup

  1. In the Lemon Squeezy dashboard, go to Settings > Webhooks
  2. Add a webhook URL: https://yourdomain.com/api/lemonsqueezy/webhook
  3. Set a signing secret and copy it to LEMONSQUEEZY_WEBHOOK_SECRET
  4. Subscribe to events: order_created, order_refunded, subscription_created, subscription_updated, subscription_cancelled, subscription_payment_success, subscription_payment_failed

For local development, use a tunneling service like ngrok or Cloudflare Tunnel to expose your local server.

Service functions

Helper functions are available in lib/services/lemonsqueezy-service.ts for creating checkout sessions and verifying webhook signatures.

On this page

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.