Payments (Stripe / Lemon Squeezy)
ShipSaaS ships with a unified checkout abstraction that delegates to either Stripe or Lemon Squeezy based on a single env var. Pick the provider that fits your business. Set both only when you intentionally expose both adapters; checkout defaults to Stripe unless a provider is selected explicitly.
- Stripe — best if you need full control, want to scale globally, or already have a Stripe account. You handle VAT and sales tax.
- Lemon Squeezy — merchant of record. They handle VAT, sales tax, and global invoicing for you. Best for solo founders who want to skip the tax paperwork.
1. Switch provider
In .env.local, set:
NEXT_PUBLIC_PAYMENT_PROVIDER=stripe # or lemonsqueezy
2a. Stripe
- Create a Stripe account and grab the Publishable and Secret keys from the API keys page.
- Create a recurring product + price for your plan. Copy the
price_xxxid. - Set
NEXT_PUBLIC_STRIPE_PREMIUM_PRICE_IDto the recurring price id. - Add a webhook endpoint in the webhooks page pointing to:
https://yourdomain.com/api/stripe/webhook
Subscribe to:checkout.session.completed,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted,invoice.payment_succeeded,invoice.payment_failed,charge.refunded. - Copy the signing secret (
whsec_xxx) intoSTRIPE_WEBHOOK_SECRET.
2b. Lemon Squeezy
- Create a Lemon Squeezy store and a subscription variant. Copy the Variant ID (a number).
- Set
NEXT_PUBLIC_LEMONSQUEEZY_PREMIUM_VARIANT_IDto the recurring variant id. - Add a webhook in Settings → Webhooks with the URL:
https://yourdomain.com/api/lemonsqueezy/webhook
Subscribe to every subscription + order event. - Copy the signing secret into
LEMONSQUEEZY_WEBHOOK_SECRET.
3. Test the integration
For Stripe, use the test mode keys and the Stripe CLI to forward webhooks locally:
stripe listen --forward-to localhost:3000/api/stripe/webhook stripe trigger checkout.session.completed
For Lemon Squeezy, use a real test card on the sandbox store.
Chargebacks: the basics
If you sell digital goods, you will see chargebacks. Most are friendly fraud (customer forgot they subscribed, a child used the card, etc). Three things that help:
- Always send a receipt immediately. Include the invoice URL on every receipt email so the customer can self-serve instead of disputing. The template does this in
src/lib/email-templates.ts. - Make the cancellation button obvious. Customers who cannot find cancel often initiate a chargeback instead. The template ships with a customer portal link on the dashboard.
- Reply to the dispute within 7 days. Upload proof of subscription, the IP address used at signup, and the most-recent successful login. Banks almost always side with the merchant when you can produce a fresh login.