@lemonsqueezy/lemonsqueezy.js
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

The official Lemon Squeezy JavaScript SDK

NPM version Functions usage APIs Count Weekly downloads NPM Downloads

Introduction

This is the official JavaScript SDK for Lemon Squeezy, helping make it easy to incorporate billing into your JavaScript application.

Features

Installation

Install the package

# bun
bun install @lemonsqueezy/lemonsqueezy.js
# pnpm
pnpm install @lemonsqueezy/lemonsqueezy.js
# npm
npm install @lemonsqueezy/lemonsqueezy.js

Create an API key

Create a new API key from Settings > API in your Lemon Squeezy dashboard.

Add this API key into your project, for example as LEMONSQUEEZY_API_KEY in your .env file.

Using the API in test mode

You can build and test a full API integration with Lemon Squeezy using test mode.

Any API keys created in test mode will interact with your test mode store data.

When you are ready to go live with your integration, make sure to create an API key in live mode and use that in your production application.

Usage

lemonSqueezySetup({ apiKey });

const { data, error, statusCode } = await getAuthenticatedUser();

console.log({ data, error, statusCode });

For more functions usage, see Wiki.

Bundle size

Click to view
export min+brotli
createDiscount 995 B
createCheckout 900 B
updateSubscriptionItem 849 B
updateSubscription 841 B
listSubscriptionItems 833 B
listSubscriptions 831 B
listWebhooks 831 B
listLicenseKeyInstances 830 B
updateLicenseKey 827 B
listUsageRecords 824 B
listDiscountRedemptions 822 B
listCustomers 820 B
listDiscounts 820 B
listProducts 819 B
listSubscriptionInvoices 819 B
listVariants 819 B
listOrderItems 818 B
listFiles 817 B
listLicenseKeys 817 B
listOrders 817 B
listStores 817 B
listCheckouts 816 B
listPrices 816 B
createWebhook 808 B
updateWebhook 793 B
deactivateLicense 764 B
validateLicense 763 B
activateLicense 762 B
createUsageRecord 728 B
getLicenseKeyInstance 706 B
getSubscriptionInvoice 702 B
getDiscountRedemption 701 B
getSubscriptionItem 700 B
getOrderItem 699 B
getWebhook 699 B
getCheckout 697 B
getFile 697 B
getLicenseKey 697 B
getUsageRecord 697 B
getCustomer 695 B
getStore 695 B
getSubscription 695 B
getOrder 693 B
getPrice 693 B
getProduct 693 B
getDiscount 692 B
getVariant 692 B
archiveCustomer 683 B
updateCustomer 683 B
createCustomer 680 B
deleteWebhook 663 B
cancelSubscription 658 B
deleteDiscount 655 B
getSubscriptionItemCurrentUsage 651 B
getAuthenticatedUser 598 B
lemonSqueezySetup 106 B

Notes

Do not use this package directly in the browser, as this will expose your API key. This would give anyone full API access to your Lemon Squeezy account and store(s). For more information see more.

Contributing

See the Contributing Guide.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    2,163
    • latest

Version History

Package Sidebar

Install

npm i @lemonsqueezy/lemonsqueezy.js

Weekly Downloads

8,525

Version

3.0.0

License

MIT

Unpacked Size

305 kB

Total Files

7

Last publish

Collaborators

  • mauryaratan
  • brankoconjic
  • gilbitron