The customer enters their key once. Your app calls Saemol directly — no server, no API key.
// 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 }),
})
const license = await res.json()
if (!license.valid) return showError(license.reason)
// reason: not_found · revoked · expired · no_access · device_limit
// Each time the app starts: same body to /api/v2/licenses/validate
Web apps · SaaS with sign-in
User accounts
Pass your user id at checkout, then ask Saemol from your server with an API key.
// 1. At checkout, put your user's id where the platform keeps your data
// Stripe: subscription_data.metadata.app_user_id
// Paddle: custom_data.app_user_id
// Saemol links the buyer to your user on the next sync.
// 2. On your server, with a workspace API key
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: 'p-focus' })
if (!access.hasAccess) return deny(access.reason)
Your product id is already filled in.
Run the first check
Run the code once. This step turns green when Saemol receives it.
Store reports (App Store, Google Play, Steam…) are totals without customers, so they never grant access on their own. WooCommerce orders grant access only when the order holds a single product.
API keys
A key acts in one environment of this workspace. Test keys see test sales only. Keep keys on your server; never ship them in an app.
No keys yet.
Webhooks
Saemol posts a signed event when an entitlement starts, changes or ends. Verify it with verifyWorkspaceWebhook() from @saemol/sdk 0.7 or later.