Saemol already reads your sales. Your app only has to ask one question: may this person use it? There are two ways to ask, and you can use both.
| License key | User accounts | |
|---|---|---|
| For | Desktop apps, games, plugins | Web apps and SaaS with sign-in |
| The customer | Enters a key once | Signs in as usual |
| Your app calls | Saemol directly, with the key | Saemol from your server, with an API key |
| You need | Nothing else — no server, no API key in the app | A workspace API key (Developers) |
Plan: every plan. Rules count against the plan's entitlement-rule limit.
1. Choose what a sale unlocks
In Entitlements → Rules, add a rule: when this item sells on a platform, unlock this product. Choose how long: for life, a number of days, or while the subscription is paid. For license keys, tick Issue a license key and set how many devices one key may run on (3 by default).
Which platforms can unlock access:
| Kind | Platforms | Why |
|---|---|---|
| Purchases and subscriptions | FastSpring, Gumroad, Hotmart, Lemon Squeezy, Paddle, Polar, Whop, WooCommerce | Each sale names the buyer and the item |
| Subscriptions only | Stripe | Stripe names the buyer and the product on the subscription, not on the payment, so a Stripe rule lasts while the subscription is paid |
| Not at all | App Store, Google Play, Steam and other store reports | Reports are totals without buyers. For these sales you can issue a key by hand |
WooCommerce orders unlock access only when the order holds a single product.
2a. License keys
When a buyer's access starts, Saemol issues one key per buyer and product, such as SML-3F9A2-C81D0-7B4E9-A05C2 (test-mode keys start with SMLT-). You get it two ways:
- the
license.issuedwebhook (Developers → Webhooks) carries the key, so your server can email it; - Entitlements → License keys lists every key with a copy button.
Your app then calls Saemol with the key. No API key is involved, so nothing secret ships inside your app.
// When the customer enters their key (once per computer)
const res = await fetch('https://saemol.com/api/v2/licenses/activate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ license_key: key, device_id: deviceId, device_name: 'Studio Mac' }),
})
const license = await res.json()
if (!license.valid) return showError(license.reason)
// Each time the app starts: the same body to /api/v2/licenses/validate
// To move to another computer: the same body to /api/v2/licenses/deactivateWith the Node SDK (@saemol/sdk 0.8.0 or later): activateLicense({ licenseKey, deviceId }), validateLicense(...), deactivateLicense(...).
device_id is any stable id you choose for the computer or install. Saemol stores only a hash of it. The customer may type the key in any case, with or without dashes.
Every well-formed request answers 200 with valid. When it is false, reason says why:
| reason | Meaning | What your app can do |
|---|---|---|
not_found | No such key | Ask the customer to check the key |
no_access | The sale behind the key no longer grants access (refunded, subscription ended) | Show your purchase page |
expired | A key issued by hand passed its end date | Show your purchase page |
revoked | You revoked the key | Contact support |
device_limit | The key is active on as many devices as allowed | Ask to deactivate another device, or free them in the console |
not_activated | validate with a device the key was never activated on | Call activate |
A key never decides access on its own: it follows the sale. A refund that ends access ends the key; if the same buyer buys again, the same key works again. Keys are limited to 30 calls a minute each — validate when the app starts, cache the answer, and allow a grace period when the computer is offline.
Keys issued by hand (Entitlements → License keys → Issue a key by hand) are for sales Saemol cannot see: another store, an invoice, a gift. They can have their own end date, are marked by hand, and are never counted as sales.
2b. User accounts
Put your own user id where the platform keeps your data at checkout, under the name app_user_id:
| Platform | Where |
|---|---|
| Stripe | subscription_data.metadata.app_user_id in Checkout, or metadata.app_user_id on the subscription |
| Paddle | custom_data.app_user_id on the transaction |
Saemol links that buyer to your user on the next sync. It never changes a link you already made: a buyer linked to another user stays with that user. For other platforms, or if you prefer, link from your server with customers.link() right after checkout.
Then ask from your server:
import { Saemol } from '@saemol/sdk'
const saemol = new Saemol({ apiKey: process.env.SAEMOL_API_KEY })
const access = await saemol.entitlements.check({ appUserId: user.id, productId: 'PRODUCT_ID' })
if (!access.hasAccess) return deny(access.reason)3. Check that it works
Developers → Connect your app turns step 3 green when Saemol receives the first activation or API call.
From sale to use
Entitlements → License keys shows, per platform: buyers under rules that issue keys, keys issued, keys activated on a device, and keys checked in the last 30 days. A platform where many buyers never activate is worth a look — an unclear download page, or customers who bought and forgot.
What Saemol does not do
- It does not guess who a buyer is. A link comes from
app_user_idyou set, or from your owncustomers.link()call. - It does not cut access the moment a refund arrives unless your rule says so: by default the refund waits in the review queue and access stays until you decide.
- It does not issue keys for store reports (App Store, Google Play, Steam): those have no buyers. Issue those by hand.
This guide is kept with Saemol’s code and changes when the connector does.