Stigg provides backend SDKs and APIs that allow you to manage customers, subscriptions, entitlements, and usage reporting from your server-side application.
For the Sidecar SDK (gRPC-based, optimized for low-latency entitlement checks), see the dedicated Sidecar SDK page.
All SDKs are initialized with the Full access key. The SDK instance should be initialized once per process (singleton pattern) and reused throughout your application, as it maintains an internal cache and supports retries.
When a new customer is provisioned in your application (for example, during registration or onboarding), you should also provision them in Stigg.You provide the customer’s unique identifier, and optionally their name, billing email address, a coupon to apply, initial subscription parameters, billing and shipping addresses (including tax IDs and payment method), and arbitrary metadata.
To control the customer’s initial access to a product according to the product’s Customer Journey settings, initial subscription parameters must be provided. To provision a customer without any default subscription, explicitly pass no subscription parameters.
Passing billing information will cause the customer to be synced to the integrated billing solution even if they don’t have any paid subscriptions. Billing information is not persisted on Stigg’s servers.
Copy
Ask AI
const customer = await stiggClient.provisionCustomer({ customerId: 'customer-test-id', name: 'My very first customer', // optional email: 'john@example.com', // optional - billing email address couponId: 'coupon-test-id', // optional subscriptionParams: { // optional - pass null to skip initial subscription planId: 'plan-basic', resourceId: 'resource-01', // optional, required for multiple subscription for same product billableFeatures: [{ // optional, required for subscriptions with per unit pricing featureId:'feature-01-templates', quantity: 2 }], billingPeriod: 'MONTHLY', // optional, relevant only for paid subscriptions addons: [{ // optional addonId: 'addon-extra-stuff', quantity: 1, }], promotionCode: 'STIGG30', // optional billingCountryCode:'DK', // optional, required for price localization, must be in the ISO-3166-1 format metadata: { // optional key: 'value', }, }, metadata: { // optional - metadata that will be stored in Stigg key: "value", }});
Customer information can be updated at any time. Only the fields being updated need to be sent.
Since billing information is not persisted on Stigg’s servers, the entire billing information object must be passed each time it needs to be updated.
Copy
Ask AI
const customer = await stiggClient.updateCustomer({ customerId: 'customer-test-id', email: 'john@example.com', // optional, use to update the customer's email address couponId: 'coupon-test-id', // optional, use to apply a coupon to a customer billingInfo: { // optional, use to update the customer's billing information ... }, metadata: { // optional, use to update the customer's metadata key: 'value', }});
They will no longer be returned by the Stigg API and SDKs.
New customers cannot reuse the customer ID of archived customers. When Stigg is integrated with a billing solution, archived customers will still exist in the billing solution to allow upcoming invoices to be finalized.
When a customer subscribes to a new plan (upgrade, downgrade, or initial subscription), a subscription needs to be provisioned in Stigg.You provide the customer ID and target plan ID. For paid subscriptions, the billing period (monthly or annually) is required. Additional optional parameters include:
A customer can have both a non-trial and a trial subscription to different plans of the same product in parallel.
When a customer with a trial subscription for plan X creates a new subscription for the same plan, it will be created as a non-trial (paid) subscription.
When a customer already has an active subscription for a product and a new one is created, the existing subscription is automatically cancelled.
You can explicitly skip the trial period by providing a skip-trial flag.
Retrieve a list of a customer’s active subscriptions. For products that support multiple active subscriptions, pass one or more resource IDs to filter by resource.
Query subscriptions with rich filtering, sorting, and cursor-based pagination. Useful for admin dashboards, audits, and reporting.Supported filter operators include equality, inequality, inclusion, and exclusion for strings and enums, as well as comparison operators for dates. Filters support logical AND/OR composition.Sortable fields include creation date, customer ID, environment ID, product ID, resource ID, and status.
A unified method to check any type of feature entitlement. It automatically returns the appropriate entitlement type based on the feature configuration.You provide the customer ID and feature ID. Optionally, pass a resource ID for multi-subscription products, or a requested usage amount to proactively check if additional usage would be allowed (metered features only).
Copy
Ask AI
const entitlement = await stiggClient.getEntitlement({ customerId: 'customer-demo-01', featureId: 'feature-demo-01', resourceId: 'resource-01', // optional, pass it to get entitlement of specific resource});if (entitlement.hasAccess) { // Customer has access to the feature} else { // Access denied console.log('Access denied reason:', entitlement.accessDeniedReason);}// Entitlement contains the specific entitlement details// based on feature type (boolean, numeric, or metered)switch (entitlement.type) { case "NUMERIC": console.log('Numeric value:', entitlement.value); break; case "METERED": console.log('Usage limit:', entitlement.usageLimit); console.log('Current usage:', entitlement.currentUsage); break; case "BOOLEAN": break;}
Check whether a customer’s usage of a metered feature is within the allowed quota. You can optionally provide a requested usage amount to proactively verify if a specific amount of additional usage would be allowed before performing the action.
Copy
Ask AI
const entitlement = await stiggClient.getMeteredEntitlement({ customerId: 'customer-demo-01', featureId: 'feature-demo-03', resourceId: 'resource-01', // optional options: { requestedUsage: 10 // optional, proactively check usage },});if (entitlement.hasAccess) { // has access and the requested usage is within the allowed quota} else { // the customer has exceeded his quota for this feature}
Retrieve all entitlements for a customer (or a specific resource), returning the full list of features they have access to along with usage limits and current usage.
The Stigg SDK allows you to report usage measurements for metered features. The reported usage is used to track, limit, and bill the customer’s usage of metered features.
Report usage only after the relevant resources have been provisioned in your application.
Ensure customers are not allowed to allocate new resources until an acknowledgement about the processed measurement is received from the Stigg backend.
Report pre-aggregated usage values calculated by your application. This is useful for features like seats or storage.You provide the customer ID, the metered feature ID, and the usage value. Optionally, specify a resource ID and update behavior - by default the value represents the change in usage (delta), but you can also set the usage to an absolute value.
Copy
Ask AI
// increment usage of a metered feature by 10await stiggClient.reportUsage({ customerId: 'customer-test-id', featureId: 'feature-seats', value: 10, resourceId: 'resource-01', // optional});
Report raw events from your application, which Stigg filters and aggregates to calculate customer usage. This is useful for features like monthly active users (MAUs).You provide the customer ID, event name, and an idempotency key for deduplication. Optionally, include dimensions (key-value pairs for filtering and aggregation), a resource ID, and a timestamp.
Retrieve paywall data for rendering a public pricing page or customer-facing paywall. Returns plans with their entitlements, pricing, trial configurations, compatible add-ons, and product metadata.
The response includes a cost breakdown (total, subtotal, tax), applied discount details (type, value, duration), the billing period date range, and prorated credit/debit amounts.
The Node.js Server SDK supports a streaming connection to receive real-time updates with low latency when customer entitlements or usage change.Available events:
Entitlements updated - fired when a customer’s entitlements change
Usage updated - fired when a customer’s usage is updated
Configure automatic credit recharge for customers. When a customer’s credit balance drops below a configured threshold, Stigg automatically tops up their balance.Configuration includes the threshold type (credit amount or dollar amount), threshold value, target balance to recharge to, an optional maximum monthly spend limit, and an expiration period for granted credits.
The Node.js Server SDK supports offline mode for local development and testing, avoiding network requests to the Stigg API. In offline mode, entitlement evaluations use fallback values.The Sidecar SDK (Java) supports an offline/air-gapped mode for environments with restricted network access, enabling in-memory entitlement evaluation without connecting to a Sidecar process.
The Sidecar service provides low-latency entitlement checks, handles caching, and subscribes to real-time entitlement and usage data updates. It can be deployed as a sidecar container or a standalone service.