
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
lemonsqueezy.js
Advanced tools
The official Javascript wrapper for the Lemon Squeezy API.
Please read the API reference introduction page to understand how the API works.
TODO
import LemonSqueezy from 'lemonsqueezy.js'
const ls = new LemonSqueezy(API_KEY);
const products = await ls.getProducts()
Parameters for requests should be passed in an object. For list methods, these parameters are used for filtering and for list pagination. For create and update methods, these parameters contain the values for the request.
const subscriptions = await ls.getSubscriptions({ storeId: 123, perPage: 50 })
const subscription = await ls.getSubscription({ id: 123, include: 'subscription-invoices' })
const subscription = await ls.cancelSubscription({ id: 123 })
You can use include
in every "read" method to pull in related resources (works for both individual and list methods).
const product = await ls.getProduct({ id: 123 include: 'variants' })
There are pagination parameters for every list method: page
, perPage
. If perPage
is omitted, the API returns 10 records per page.
// Querying a list of orders for store #3, 50 records per page, page 2, including store and customer related resoueces
const order = await ls.getOrders({ storeId: 3, perPage: 50, page: 2, include: 'store,customer' })
Each method will throw an exception if there are issues with the request. JSON will be returned containing error details.
Use try { ... } catch { ... }
to access this object. Error messages will be available in a list in errors
.
// "something" is not a valid value for `include`
try {
const subscriptions = await ls.getSubscriptions({ include: 'something' })
} catch (err) {
// `err` is an object like this:
// {
// "jsonapi": {
// "version": "1.0"
// }
// "errors": [
// {
// "detail": "Include path something is not allowed.",
// "source": {
// "parameter": "include"
// },
// "status": "400",
// "title": "Invalid Query Parameter"
// }
// ]
// }
}
Endpoints that return a list of results can be paged using optional page
and perPage
values.
If perPage
is omitted, the API returns the default of 10 results per page.
perPage
should be a value between 1 and 100.
You can use the lastPage
value in the meta.page
object to check if you are on the last page of results.
let hasNextPage = true
let perPage = 100
let page = 1
let variants = []
while (hasNextPage) {
const resp = await ls.getVariants({ perPage, page });
variants = variants.concat(resp['data'])
if (resp.meta.page.lastPage > page) {
page += 1
} else {
hasNextPage = false
}
}
Don't use this package directly in the browser as this will expose your API key, which would provide access to your full store.
Get the current user.
Returns a User object.
None.
const user = await ls.getUser()
Get the current user's stores.
Returns a list of Store objects.
Parameter | Type | Default | Notes |
---|---|---|---|
perPage | number | 10 | |
page | number | 1 | |
include | string | Comma-separated list of object names:
|
const stores = await ls.getStores()
const stores = await ls.getStores({ include: 'products' })
Get a store.
Returns a Store object.
Parameter | Type | Required | Default | Notes |
---|---|---|---|---|
id | number | Required | ||
include | string | No | Comma-separated list of object names:
|
const store = await ls.getStore({ id: 123 })
Get a list of products.
Returns a list of Product objects.
Parameter | Type | Required | Default | Notes |
---|---|---|---|---|
storeId | number | No | ||
perPage | number | No | 10 | |
page | number | No | 1 | |
include | string | No | Comma-separated list of object names:
|
const products = await ls.getProducts({ storeId: 123, perPage: 50, include: 'variants' })
Get a product.
Returns a Product object.
Parameter | Type | Default | Notes |
---|---|---|---|
id required | number | ||
include | string | Comma-separated list of object names:
|
const products = await ls.getProduct({ id: 123 })
More methods to follow.
FAQs
The official Javascript wrapper for the Lemon Squeezy API.
The npm package lemonsqueezy.js receives a total of 0 weekly downloads. As such, lemonsqueezy.js popularity was classified as not popular.
We found that lemonsqueezy.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.