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.
// 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.
Grant time-limited or custom-period promotional entitlements to customers, with optional usage limits and reset periods.
// Use the grantPromotionalEntitlements method — see the Node.js SDK reference for full usage:// https://node-sdk-docs.stigg.io/classes/stigg#grantpromotionalentitlements
Revoke previously granted promotional entitlements from a customer.
// Use the revokePromotionalEntitlements method — see the Node.js SDK reference for full usage:// https://node-sdk-docs.stigg.io/classes/stigg#revokepromotionalentitlements
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.