Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lemonsqueezy/lemonsqueezy.js

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lemonsqueezy/lemonsqueezy.js

The official Lemon Squeezy JavaScript SDK.

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
increased by6.24%
Maintainers
0
Weekly downloads
 
Created
Source

The official Lemon Squeezy JavaScript SDK

NPM version Functions usage APIs Count Weekly downloads NPM Downloads FOSSA Status

Introduction

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

  • Read API Reference to understand how the Lemon Squeezy API works.
  • Visit Wiki page for function usage.

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.

[!CAUTION]

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 here.

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

import {
  getAuthenticatedUser,
  lemonSqueezySetup,
} from "@lemonsqueezy/lemonsqueezy.js";

const apiKey = import.meta.env.LEMON_SQUEEZY_API_KEY;

lemonSqueezySetup({
  apiKey,
  onError: (error) => console.error("Error!", error),
});

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

if (error) {
  console.log(error.message);
} else {
  console.log(data);
}

For more functions usage, see Wiki.

Bundle size

Click to view
Exportmin+brotli
createDiscount1.01 kB
createCheckout888 B
updateSubscriptionItem856 B
updateSubscription838 B
listCheckouts824 B
listDiscountRedemptions819 B
listLicenseKeyInstances818 B
listSubscriptionInvoices816 B
listLicenseKeys815 B
listOrderItems815 B
listSubscriptionItems815 B
listUsageRecords814 B
listSubscriptions812 B
listWebhooks812 B
listCustomers811 B
listDiscounts811 B
listFiles811 B
listOrders811 B
listPrices811 B
listProducts811 B
listStores811 B
listVariants811 B
updateLicenseKey811 B
createWebhook806 B
issueSubscriptionInvoiceRefund796 B
issueOrderRefund795 B
updateWebhook792 B
generateSubscriptionInvoice787 B
generateOrderInvoice785 B
validateLicense761 B
activateLicense760 B
deactivateLicense759 B
createUsageRecord724 B
getDiscountRedemption702 B
getLicenseKeyInstance702 B
getSubscriptionInvoice699 B
getSubscriptionItem698 B
getUsageRecord698 B
getOrderItem697 B
getWebhook697 B
getLicenseKey695 B
getCheckout694 B
getStore694 B
getSubscription694 B
getCustomer692 B
getFile692 B
getOrder692 B
getPrice692 B
getDiscount691 B
getProduct691 B
archiveCustomer690 B
getVariant690 B
createCustomer686 B
updateCustomer682 B
deleteWebhook660 B
cancelSubscription658 B
deleteDiscount656 B
getSubscriptionItemCurrentUsage650 B
getAuthenticatedUser595 B
lemonSqueezySetup106 B

Contributing

See the Contributing Guide.

License

FOSSA Status

Keywords

FAQs

Package last updated on 05 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc