Lemon Squeezy
What is Lemon Squeezy?
Lemon Squeezy is an e-commerce platform designed to help creators and businesses easily sell digital products, subscriptions, and software online. It’s particularly well-suited for selling WordPress plugins. Lemon Squeezy supports multiple payment gateways, including Stripe and PayPal, and handles all the complexities of global e-commerce, such as VAT and sales tax.
WunderUpdates integrates directly with Lemon Squeezy, allowing you to sell your plugins through their platform while having WunderUpdates enforce licensing.
Optionally enforce Lemon Squeezy activation limits
When a user purchases a plugin from you via Lemon Squeezy, they will receive a license key. As part of setting up your product in the Lemon Squeezy dashboard, you can specify the number of activations the license key allows. In the WordPress world, this is pretty much always equivalent to the number of sites on which the plugin can be activated.
- Non-enforced Activation Limit - In this mode, WunderUpdates does not enforce the activation limit. The user can activate the plugin on as many sites as they want, as long as they have a valid license key.
- Enforced Activation Limit - In this mode, WunderUpdates will enforce the activation limit. The user can only activate the plugin on the number of sites you have configured in Lemon Squeezy.
When WunderUpdates enforces the activation limit, it uses the WordPress site name as the unique identifier for a license instance. For example, if a user installs your plugin on www.example.com
and www.example.org
, they will have used two activations on their license key.
Getting started with Lemon Squeezy
Instead of repeating all the information here, we recommend you start by reading the Lemon Squeezy documentation on how to get started and how to configure license keys.
The general start-up guide is available here: https://docs.lemonsqueezy.com/guides/getting-started.
To learn how to add license keys to your products, see the guide here: https://docs.lemonsqueezy.com/guides/tutorials/license-keys
Finding the product ID
Once you've set up Lemon Squeezy and added your products, you need to find the product ID for each product you want to add to WunderUpdates.
To find the product ID of your product, go to the Lemon Squeezy dashboard and click on the product you want to get the ID for. The product ID is then shown in the URL of the product page.
You can also click the three-dot menu in the top right corner of the product page and select "Copy product ID" to copy the ID to your clipboard.
Configuring a WunderUpdates plugin to use Lemon Squeezy
To create a new plugin that uses Lemon Squeezy:
curl -X POST https://api.wunderupdates.com/v1/plugins \
-H "x-api-key: YOUR_API_KEY" \
-d '{"slug": "hello-world", "license": {"type": "lemonsqueezy", "products": [12345]}}'
Or to update an existing plugin to use static keys:
curl -X POST https://api.wunderupdates.com/v1/plugins/hello-world/license \
-H "x-api-key: YOUR_API_KEY" \
-d '{"type": "lemonsqueezy", "products": [12345]}'
As you can see, besides setting the license type to lemonsqueezy
, you also need to provide a product id. Since you may have more than one product in Lemon Squeezy that should be associated with the plugin, you need to provide an array of IDs rather than a single ID.
To verify that Lemon Squeezy is set as the license provider:
curl -X GET https://api.wunderupdates.com/v1/plugins/hello-world \
-H "x-api-key: THE_API_KEY"
The response should look something like:
{
"plugin": {
"latestRelease": "1.0",
"license": {
"type": "lemonsqueezy",
"products": [12345]
},
"latestPreRelease": "",
"instanceId": "7282b021-9af6-43bd-bd0b-4de30ebba4b0",
"versions": [
{
"file": "hello-world-1.0.zip",
"version": "1.0"
}
],
"slug": "hello-world",
"latest": "1.0"
},
"status": 200
}
Enforcing activation limits
If you want to enforce the activation limit set in Lemon Squeezy, the JSON object you send to the API needs one additional property, enforceActivationLimit
, set to true
.
{
"slug": "hello-world",
"license": {
"type": "lemonsqueezy",
"products": [12345],
"enforceActivationLimit": true
}
}
The curl command to create a new plugin with Lemon Squeezy and an enforced activation limit would look like this:
curl -X POST https://api.wunderupdates.com/v1/plugins \
-H "x-api-key: YOUR_API_KEY" \
-d '{"slug": "hello-world", "license": {"type": "lemonsqueezy", "products": [12345], "enforceActivationLimit": true}}'
Or to update an existing plugin to use Lemon Squeezy with an enforced activation limit:
curl -X POST https://api.wunderupdates.com/v1/plugins/hello-world/license \
-H "x-api-key: YOUR_API_KEY" \
-d '{"type": "lemonsqueezy", "products": [12345], "enforceActivationLimit": true}'