Reference SDK reference

SDK reference

Every method, framework binding, type and option of the @extensionbill/sdk package, with the context each one works in.

The complete public API of @extensionbill/sdk. Use it to look up a method, its return value or its errors. To install the SDK and create the shared bill client, follow the Quickstart.

import { ExtensionBill, ExtensionBillError } from '@extensionbill/sdk'

const bill = ExtensionBill({ publishableKey: 'pk_test_…' })

Methods

MethodWhat it doesReturns
ExtensionBill(options)Creates the client.ExtensionBillClient
startBackground()Runs the background half of the SDK. Service worker only.void
getUser()Current user state, cached for 5 minutes.Promise<UserState>
hasAccess(user?, feature?)Synchronous access check.boolean
openCheckout(priceId?, opts?)Opens hosted checkout in a new tab.Promise<void>
openPortal()Opens the customer portal.Promise<void>
openRestore()Opens the “restore purchases” email-code flow.Promise<void>
startTrial()Starts the install free trial.Promise<UserState>
activateLicense(key, label?)Activates a license key on this install.Promise<UserState>
deactivateLicense()Frees this install’s license seat.Promise<UserState>
getPlans()Your products and prices, for a custom paywall.Promise<PlansResponse>
refresh()Fresh state from the server, no cache.Promise<UserState>
onChange(cb)Listens to state changes in every context.unsubscribe function
onPaid(cb)Listens to the unpaid to paid transition.unsubscribe function
getInstallId()This install’s ID, for support and your server.Promise<string>
createUserStore(bill)Shared, subscribable user state for any UI.UserStore

Every method works in the service worker, popups, options pages, side panels and content scripts, except startBackground(), which runs only in the service worker. Outside the service worker, calls go via the bridge: they are forwarded over runtime.sendMessage and answered by startBackground(). Content scripts always use the bridge, because their own requests would carry the web page’s origin. Extension pages fall back to calling the API directly when the service worker does not answer.

Framework bindings

Each binding wraps createUserStore for one framework. Use them in UI contexts (popup, options page, side panel, new tab page). Content scripts use the methods above.

ImportAPIGuide
@extensionbill/sdk/reactuseUser(bill) returns { user, loading, error, hasAccess(feature?), refresh() }React
@extensionbill/sdk/preactuseUser(bill), same shape as ReactPreact
@extensionbill/sdk/vueuseUser(bill) returns refs user, loading, error plus hasAccess(feature?), refresh()Vue
@extensionbill/sdk/svelteuserStore(bill) returns a Svelte store of UserSnapshot plus hasAccess(feature?), refresh()Svelte
@extensionbill/sdk/angularinjectUser(bill) returns signals user, loading, error plus hasAccess(feature?), refresh()Angular
@extensionbill/sdk/solidcreateUser(bill) returns accessors user, loading, error plus hasAccess(feature?), refresh()Solid
@extensionbill/sdk/litnew UserController(host, bill) with fields user, loading, error plus hasAccess(feature?), refresh()Lit
@extensionbill/sdkcreateUserStore(bill) for vanilla JS and any other frameworkVanilla JS
@extensionbill/sdk/paywallmountPaywall(el, bill, opts?), a ready-made plan pickerPaywall UI

Comparison and setup: Frameworks.

ExtensionBill(options)

function ExtensionBill(options: ExtensionBillOptions): ExtensionBillClient

Creates a client. Create it once in a shared module and import it from every context.

OptionTypeDefaultDescription
publishableKeystringrequiredpk_test_… (Sandbox) or pk_live_… (Live). Any other value throws invalid_publishable_key synchronously.
apiBasestringhttps://api.extensionbill.comAPI base URL. Leave the default unless you were given another endpoint.
hostedOriginstringhttps://app.extensionbill.comOrigin of the hosted checkout, portal and restore pages, used to recognize their tabs.
timeoutMsnumber15000Timeout for every API request.
debugbooleanfalseLogs requests, bridge traffic and state changes with console.debug.
verifyOfflinebooleantrueVerifies the cached entitlement token’s signature before trusting it. Keep it on. See Caching and offline grace.

startBackground()

bill.startBackground(): void

Service worker (or Firefox background event page) only. Call it once, synchronously, at the top level of the script. Setup is in the Quickstart.

It:

  • Registers the install with POST /v1/sdk/installs on runtime.onInstalled and runtime.onStartup (reason install, update or startup). The first registration stores the install ID and it_… install token in chrome.storage.local and mirrors them to chrome.storage.sync. If local storage is empty but sync holds an install for the same publishable key, the SDK reuses it instead of creating a new one.
  • Sets the uninstall URL returned by the API with runtime.setUninstallURL, so uninstalls are counted and can collect feedback.
  • Creates an extensionbill-refresh alarm (every 6 hours) when the alarms permission is declared.
  • Answers bridged calls from popups, options pages, side panels and content scripts.
  • Watches checkout tabs and refreshes after a purchase. See Checkout completion detection.
  • Accepts { type: 'extensionbill:refresh' } from the hosted success page when you add the optional externally_connectable entry.

Registration is asynchronous. Network failures are not thrown: they are retried on the next startup or getUser() call and logged when debug is on. Calling it outside a background context throws unsupported_context.

getUser()

bill.getUser(): Promise<UserState>

Resolves with the current UserState for this install.

  • A cached state under 5 minutes old (whose entitlement token verifies, when verifyOffline is on) is returned without a request.
  • Otherwise it calls GET /v1/sdk/user, stores the result and notifies onChange listeners if anything changed.
  • On a network error, timeout, 429 or 5xx it falls back to the cached state while its token is unexpired and correctly signed, then to a free state. See Caching and offline grace.
  • It registers the install first if needed. Concurrent calls share one request.

Errors: network_error or timeout only when there is no cached state at all (the very first call made offline). API errors such as invalid_publishable_key, extension_not_allowed or live_not_enabled. background_unavailable in a content script when the service worker does not run startBackground().

const user = await bill.getUser()
document.querySelector('#plan').textContent = user.plan?.name ?? 'Free'

hasAccess(user?, feature?)

bill.hasAccess(user?: UserState | null, feature?: string): boolean
bill.hasAccess(feature: string): boolean

Synchronous, never touches the network, never throws. Rules, in order:

  1. Returns false when there is no state or its entitlement token has expired.
  2. Returns true for every feature while an install trial is active (trial.active and trial.endsAt in the future).
  3. With feature: returns user.entitlements.includes(feature). Features are product entitlement keys such as 'pro', set per product in the dashboard.
  4. Without feature: returns user.paid.

When user is omitted, it uses the last UserState this context has seen (from getUser(), refresh(), startTrial(), license calls or onChange), and returns false before any state has loaded. hasAccess('pro') is shorthand for hasAccess(<last seen user>, 'pro').

A buyer inside a PayPal subscription trial (a price with trialDays) has an active entitlement, so paid is true and hasAccess returns true for that product’s key.

const user = await bill.getUser()
if (bill.hasAccess(user)) showProUi()
if (bill.hasAccess(user, 'team')) showTeamSettings()

openCheckout(priceId?, opts?)

bill.openCheckout(priceId?: string, opts?: { email?: string; discountCode?: string }): Promise<void>

Creates a session with POST /v1/sdk/checkout-sessions, opens https://app.extensionbill.com/pay/<sessionId> in a new tab and resolves once the tab is open. The background watches the tab and refreshes the state when the purchase completes.

ArgumentDescription
priceIdA PublicPrice.id from getPlans(). Omit it to show the hosted plan picker with all active plans.
opts.emailPrefills the buyer’s email.
opts.discountCodePre-applies a discount code. The buyer can still change it if your app allows discount codes.

Opening a tab closes the popup. That is expected: the background keeps watching, and the next getUser() returns the upgraded state.

Errors: paypal_not_connected, live_not_enabled, validation_error, network_error, timeout.

document.querySelector('#upgrade').addEventListener('click', async () => {
  try {
    await bill.openCheckout()
  } catch (err) {
    showError(err.message)
  }
})

// Straight to the yearly price with a launch discount
await bill.openCheckout(yearlyPriceId, { discountCode: 'LAUNCH20' })

openPortal()

bill.openPortal(): Promise<void>

Calls POST /v1/sdk/portal-sessions and opens the hosted customer portal: receipts, subscription changes and cancellation, license devices. When the install is linked to a customer the portal opens signed in; otherwise the buyer signs in with an email code.

document.querySelector('#manage').addEventListener('click', () => bill.openPortal())

openRestore()

bill.openRestore(): Promise<void>

Calls POST /v1/sdk/restore-sessions and opens https://app.extensionbill.com/restore/<id>. The buyer enters the email they paid with and confirms a one-time code, and this install is linked to their purchases. The background refreshes when the restore tab completes or closes. See Restore purchases.

document.querySelector('#restore').addEventListener('click', () => bill.openRestore())

startTrial()

bill.startTrial(): Promise<UserState>

Starts the app-level free trial for this install with POST /v1/sdk/trial. Trial length comes from your app settings. Show a trial button only when user.trial.available is true. Resolves with the updated state (trial.active: true, trial.endsAt, trial.daysLeft). See Free trials.

Errors: trial_unavailable (409) when trials are disabled or this install already used its trial.

try {
  const user = await bill.startTrial()
  showToast(`Trial started: ${user.trial.daysLeft} days of Pro`)
} catch (err) {
  if (err instanceof ExtensionBillError && err.code === 'trial_unavailable') {
    showToast('Your free trial has already been used.')
  } else {
    throw err
  }
}

activateLicense(key, label?)

bill.activateLicense(key: string, label?: string): Promise<UserState>

Activates a license key (XXXX-XXXX-XXXX-XXXX) on this install with POST /v1/sdk/licenses/activate, using one seat. label names the device in the customer portal (for example "Work laptop"). Resolves with license set and the product’s key in entitlements. See License keys.

ErrorStatusMeaning
license_not_found404No license with this key in this environment.
license_revoked409The license was revoked (for example after a refund).
license_expired409The license reached its expiry date.
seat_limit_reached409All seats are used. details is { seatLimit, seatsUsed }.
invalid_argument0Empty key, rejected before any request.
try {
  await bill.activateLicense(input.value, 'Chrome on ' + navigator.platform)
} catch (err) {
  if (err.code === 'seat_limit_reached') {
    showError(`This key is active on ${err.details.seatsUsed} of ${err.details.seatLimit} devices. Remove one in the customer portal.`)
  } else {
    showError(err.message)
  }
}

deactivateLicense()

bill.deactivateLicense(): Promise<UserState>

Releases this install’s seat with POST /v1/sdk/licenses/deactivate, so the key can be used on another device. Resolves with license: null and without the license entitlement.

getPlans()

bill.getPlans(): Promise<PlansResponse>

Fetches your active products and prices with GET /v1/sdk/plans, in dashboard sort order, plus your app’s name, icon, brand color and trial settings. Archived products and inactive prices are never included. Use it to build a custom paywall, or use the ready-made Paywall UI.

const { plans, trial } = await bill.getPlans()

for (const plan of plans) {
  for (const price of plan.prices) console.log(plan.name, price.formatted, price.id)
}
if (trial.enabled) console.log(`${trial.days}-day free trial available`)

refresh()

bill.refresh(): Promise<UserState>

Always fetches a fresh state from the API, ignoring the 5-minute cache, stores it and notifies onChange listeners. Use it behind a “Refresh” or “I already paid” button. Unlike getUser() it never falls back to the cache: it rejects with network_error, timeout or the API error.

onChange(cb)

bill.onChange(cb: (user: UserState, prev: UserState | null) => void): () => void

Called whenever the stored state changes: purchase, renewal, cancellation, refund, trial start or end, license change, restore. It fires in every context that registered a listener, whichever context caused the change. prev is the previous state, or null. Returns a function that removes the listener.

const unsubscribe = bill.onChange((user, prev) => {
  render(user)
  if (prev?.subscription && !user.subscription) showToast('Your subscription has ended.')
})

onPaid(cb)

bill.onPaid(cb: (user: UserState) => void): () => void

Called when user.paid goes from false to true: a completed checkout, a restore, a license activation or a manual grant. It does not fire for a state that was already paid when the listener was added, nor for renewals. Returns a function that removes the listener.

// background.js
bill.onPaid(() => {
  chrome.tabs.create({ url: chrome.runtime.getURL('welcome-pro.html') })
})

getInstallId()

bill.getInstallId(): Promise<string>

Returns this install’s ID (a UUID), registering the install first if needed. It appears in the dashboard under Installs, so ask users for it in support requests. Your server can look it up with the Server API.

createUserStore(bill)

import { createUserStore } from '@extensionbill/sdk'

function createUserStore(bill: ExtensionBillClient): UserStore

Framework-agnostic user state that every framework binding is built on. Calling it again with the same bill returns the same store, so all UI shares one load and one onChange subscription.

  • The first snapshot is { user: null, loading: true, error: null }.
  • The first subscribe() attaches bill.onChange and calls bill.getUser() (unless a user is already loaded). The last unsubscribe detaches onChange.
  • A load or onChange sets { user, loading: false, error: null }. A failed load keeps the previous user and sets error (always an ExtensionBillError).
  • Listeners run only when the snapshot changes, and are not called on subscribe.
import { createUserStore } from '@extensionbill/sdk'
import { bill } from './bill.js'

const store = createUserStore(bill)
const unsubscribe = store.subscribe(({ loading }) => {
  if (!loading) document.body.classList.toggle('pro', store.hasAccess('pro'))
})

Types: UserSnapshot and UserStore. Full walkthrough: Vanilla JS.

Standalone exports

These work without a client, for example in a build script or a backend on Node 20+ (they use WebCrypto).

ExportDescription
hasAccess(user, feature?)The same check as bill.hasAccess, for a UserState you already have.
verifyEntitlementToken(token, jwks, options?)Verifies an ES256 entitlement token against a JWKS. options: audience (expected aud, your publishable key), subject (expected sub, the install ID), now (clock in milliseconds). Resolves to the claims, or null when the signature, expiry, audience or subject check fails.
decodeEntitlementToken(token)Decodes a token without verifying it. Returns { header, claims, signingInput, signature } or null. For display or debugging only.
ExtensionBillErrorThe error class every SDK method rejects with.
DEFAULT_API_BASEhttps://api.extensionbill.com
DEFAULT_HOSTED_ORIGINhttps://app.extensionbill.com
SERVER_ERROR_CODES, SDK_ERROR_CODESArrays of every error code. See Error codes.
import { verifyEntitlementToken } from '@extensionbill/sdk'

const jwks = await fetch('https://api.extensionbill.com/v1/sdk/jwks.json').then((res) => res.json())
const claims = await verifyEntitlementToken(token, jwks, {
  audience: 'pk_live_…',
  subject: installId,
})
if (claims?.paid) {
  // The token is genuine, unexpired, and issued for this install.
}

Caching and offline grace

The SDK caches the last UserState in chrome.storage.local under extensionbill:userState, so access checks are instant and keep working offline.

Every UserState includes entitlementToken, an ES256-signed JWT issued by ExtensionBill:

{
  "sub": "7c1e2b0a-4f5d-4d8e-9a43-0f3f6c2e9b11",
  "aud": "pk_live_…",
  "paid": true,
  "entitlements": ["pro"],
  "trialEndsAt": null,
  "iat": 1791820800,
  "exp": 1792080000
}
  • The token expires 72 hours after it was issued. That is the offline grace period: a paying user who goes offline keeps access for up to 72 hours after the last successful check.
  • With verifyOffline: true, the SDK verifies the signature with WebCrypto against the keys from GET /v1/sdk/jwks.json (cached under extensionbill:jwks), and checks that sub is this install and aud is your publishable key.
  • An invalid or expired token makes the user free: paid: false, plan: null, entitlements: [], trial.active: false, trial.daysLeft: null. Other fields (installId, env, customer, subscription, license, trial.available) are kept so your UI can still show account details. This free state is never stored; the next successful request replaces it.

Editing chrome.storage.local by hand cannot unlock paid features, because a forged state fails verification. Any check inside an extension can still be patched out of its code, so features that matter on a server must be checked on that server. See Checking access.

SituationgetUser() result
Online, cache under 5 minutes oldCached state
Online, cache olderFresh state from the API
Offline, valid tokenCached state
Offline, token expired or invalidFree state
Offline, never registeredRejects with network_error or timeout

Checkout completion detection

After openCheckout(), the background detects the end of payment without any extra permission:

  1. Tab watching. It follows the tab with tabs.onUpdated and tabs.onRemoved. When the tab reaches the completed state of /pay/<sessionId> or is closed, it refreshes with backoff (1s, 2s, 4s and so on, up to 60s) until the state changes. PayPal webhooks can arrive a few seconds after the success page, which is why it retries.
  2. Polling. While a checkout tab is open it also polls GET /v1/sdk/user with exponential backoff, so a payment completed in another window is picked up too.
  3. Instant ping (optional). The hosted success page calls chrome.runtime.sendMessage(<your extension ID>, { type: 'extensionbill:refresh' }). It reaches your extension only if the manifest has "externally_connectable": { "matches": ["https://app.extensionbill.com/*"] }. With it, unlocking is immediate.

Restore tabs opened by openRestore() are watched the same way. When the new state arrives, onChange fires in every context, and onPaid fires if the user went from free to paid.

Pending PayPal payments (for example eChecks) show a “processing” result on the checkout page. Access is granted only when PayPal completes the capture, which can take days; the alarm-based refresh picks it up.

HTTP endpoints

The SDK calls these for you. They are listed for debugging, for example in the Network tab of your service worker’s DevTools. Paths are relative to https://api.extensionbill.com. Every request sends X-Publishable-Key: pk_…; install calls also send Authorization: Bearer it_….

MethodPathUsed byReturns
POST/v1/sdk/installsstartBackground(), first getUser(){ installId, installToken, uninstallUrl, user } (installToken only on creation)
GET/v1/sdk/usergetUser(), refresh()UserState
GET/v1/sdk/plansgetPlans()PlansResponse
POST/v1/sdk/checkout-sessionsopenCheckout(){ id, url }
POST/v1/sdk/trialstartTrial()UserState
POST/v1/sdk/portal-sessionsopenPortal(){ url }
POST/v1/sdk/restore-sessionsopenRestore(){ id, url }
POST/v1/sdk/licenses/activateactivateLicense()UserState
POST/v1/sdk/licenses/deactivatedeactivateLicense()UserState
POST/v1/sdk/logoutNoneUserState (unlinks the customer from this install)
GET/v1/sdk/jwks.jsonoffline verificationJWKS of the entitlement signing key

Install registration is limited to 30 requests per minute per IP. A live key used before you go live gets 403 live_not_enabled; an extension ID outside your allowed list gets 403 extension_not_allowed.

Types

All types are exported from @extensionbill/sdk. Dates are ISO 8601 strings in UTC.

UserState

type UserState = {
  installId: string
  env: 'sandbox' | 'live'
  /** True when any entitlement is active. */
  paid: boolean
  /** Highest-ranked active entitlement, or null for free users. */
  plan: {
    productId: string
    entitlementKey: string
    name: string
    priceId?: string
    type: 'one_time' | 'recurring' | 'manual' | 'license'
    interval?: 'day' | 'week' | 'month' | 'year'
    intervalCount?: number
  } | null
  /** Entitlement keys of every active entitlement. */
  entitlements: string[]
  trial: {
    available: boolean
    active: boolean
    startedAt: string | null
    endsAt: string | null
    daysLeft: number | null
  }
  subscription: {
    id: string
    status: 'approval_pending' | 'active' | 'past_due' | 'suspended' | 'canceled' | 'expired'
    currentPeriodEnd: string | null
    cancelAt: string | null
    trialEndsAt: string | null
  } | null
  license: {
    last4: string
    status: 'active' | 'revoked' | 'expired'
    seatLimit: number | null
    seatsUsed: number
    expiresAt: string | null
  } | null
  customer: { email: string; name: string | null } | null
  /** ES256 JWT: { sub: installId, aud: publishableKey, paid, entitlements, trialEndsAt, iat, exp } */
  entitlementToken: string
  checkedAt: string
}
  • plan is the active entitlement whose product has the highest sort order in your dashboard. plan.type tells where access came from: a one-time order, a subscription, a manual grant or a license key.
  • subscription is the install’s most relevant PayPal subscription. With cancelAt set it still grants access until that date; past_due keeps access during your dunning grace period. See Subscription lifecycle.
  • trial is the app-level install trial. A PayPal subscription trial is subscription.trialEndsAt.
  • license never contains the full key, only last4.
  • customer is set once the install is linked to a buyer (after checkout or restore).

PublicPlan

type PublicPlan = {
  productId: string
  name: string
  description: string | null
  /** Bullet points shown on the paywall. */
  features: string[]
  entitlementKey: string
  /** Render this plan as the recommended one. */
  highlight: boolean
  license: { enabled: boolean; seatLimit: number | null }
  prices: PublicPrice[]
}

PublicPrice

type PublicPrice = {
  /** Pass to bill.openCheckout(price.id). */
  id: string
  nickname: string | null
  type: 'one_time' | 'recurring'
  /** Integer minor units: 499 = 4.99 USD; 500 JPY = ¥500. */
  amount: number
  /** Uppercase ISO 4217 code. */
  currency: string
  interval: 'day' | 'week' | 'month' | 'year' | null
  intervalCount: number | null
  /** PayPal subscription trial length (recurring prices only). */
  trialDays: number | null
  /** Setup fee in minor units. */
  setupFee: number | null
  /** Ready-to-display label, for example "$4.99 / month". */
  formatted: string
}

PlansResponse

type PlansResponse = {
  app: { name: string; iconUrl?: string | null; brandColor: string }
  plans: PublicPlan[]
  trial: { enabled: boolean; days: number }
}

UserSnapshot and UserStore

interface UserSnapshot {
  /** null until the first load finishes. */
  user: UserState | null
  /** true until the first getUser() settles. */
  loading: boolean
  error: ExtensionBillError | null
}

interface UserStore {
  /** Same object until the state changes (safe for React useSyncExternalStore). */
  getSnapshot(): UserSnapshot
  /** Does not call listener immediately. Returns the unsubscribe function. */
  subscribe(listener: (snapshot: UserSnapshot) => void): () => void
  /** bill.hasAccess(getSnapshot().user, feature) */
  hasAccess(feature?: string): boolean
  /** bill.refresh(), then updates the snapshot. Stores the error and rethrows on failure. */
  refresh(): Promise<UserState>
}

ExtensionBillError

class ExtensionBillError extends Error {
  /** Stable snake_case code, e.g. 'trial_unavailable'. Branch on this. */
  readonly code: string
  /** HTTP status for API errors; 0 when no response was received. */
  readonly status: number
  /** Extra data, e.g. { seatLimit, seatsUsed } for seat_limit_reached. */
  readonly details: unknown
}

API errors carry the server’s body { statusCode, code, message, details }: status is statusCode. message is readable but may change, so branch on code. Errors raised inside the SDK (network_error, timeout, invalid_argument and others) have status: 0, except invalid_response. Every code, and a full handling example, is in Error codes.

Sample UserState values

Free user:

{
  "installId": "7c1e2b0a-4f5d-4d8e-9a43-0f3f6c2e9b11",
  "env": "live",
  "paid": false,
  "plan": null,
  "entitlements": [],
  "trial": { "available": true, "active": false, "startedAt": null, "endsAt": null, "daysLeft": null },
  "subscription": null,
  "license": null,
  "customer": null,
  "entitlementToken": "eyJhbGciOiJFUzI1NiIsImtpZCI6IjIwMjYtMTAifQ.eyJzdWIiOiI3YzFlMmIwYS…",
  "checkedAt": "2026-10-12T09:30:00.000Z"
}

Install trial in progress (paid is false, but hasAccess() returns true for every feature until endsAt):

{
  "installId": "7c1e2b0a-4f5d-4d8e-9a43-0f3f6c2e9b11",
  "env": "live",
  "paid": false,
  "plan": null,
  "entitlements": [],
  "trial": {
    "available": false,
    "active": true,
    "startedAt": "2026-10-10T08:00:00.000Z",
    "endsAt": "2026-10-17T08:00:00.000Z",
    "daysLeft": 5
  },
  "subscription": null,
  "license": null,
  "customer": null,
  "entitlementToken": "eyJhbGciOiJFUzI1NiIsImtpZCI6IjIwMjYtMTAifQ.eyJzdWIiOiI3YzFlMmIwYS…",
  "checkedAt": "2026-10-12T09:30:00.000Z"
}

Active subscriber:

{
  "installId": "7c1e2b0a-4f5d-4d8e-9a43-0f3f6c2e9b11",
  "env": "live",
  "paid": true,
  "plan": {
    "productId": "6703f1c2a9e4b1d2c3f4a5b6",
    "entitlementKey": "pro",
    "name": "Pro",
    "priceId": "6703f1c2a9e4b1d2c3f4a5b7",
    "type": "recurring",
    "interval": "month",
    "intervalCount": 1
  },
  "entitlements": ["pro"],
  "trial": { "available": false, "active": false, "startedAt": "2026-09-01T08:00:00.000Z", "endsAt": "2026-09-08T08:00:00.000Z", "daysLeft": null },
  "subscription": {
    "id": "6703f2d8a9e4b1d2c3f4a5c1",
    "status": "active",
    "currentPeriodEnd": "2026-11-05T10:12:44.000Z",
    "cancelAt": null,
    "trialEndsAt": null
  },
  "license": null,
  "customer": { "email": "buyer@example.com", "name": "Sample Buyer" },
  "entitlementToken": "eyJhbGciOiJFUzI1NiIsImtpZCI6IjIwMjYtMTAifQ.eyJzdWIiOiI3YzFlMmIwYS…",
  "checkedAt": "2026-10-12T09:30:00.000Z"
}

License key user:

{
  "installId": "d2a9f0c4-1b7e-4c55-8e2d-6a0b3c9f7e21",
  "env": "live",
  "paid": true,
  "plan": {
    "productId": "6703f1c2a9e4b1d2c3f4a5b8",
    "entitlementKey": "pro",
    "name": "Pro Lifetime",
    "type": "license"
  },
  "entitlements": ["pro"],
  "trial": { "available": true, "active": false, "startedAt": null, "endsAt": null, "daysLeft": null },
  "subscription": null,
  "license": {
    "last4": "7QXM",
    "status": "active",
    "seatLimit": 3,
    "seatsUsed": 2,
    "expiresAt": null
  },
  "customer": { "email": "user@example.com", "name": null },
  "entitlementToken": "eyJhbGciOiJFUzI1NiIsImtpZCI6IjIwMjYtMTAifQ.eyJzdWIiOiJkMmE5ZjBjNC…",
  "checkedAt": "2026-10-12T09:30:00.000Z"
}