New Features
Entitlements Aggregation Engine
When a customer has multiple subscriptions, the API can return duplicatefeatureId entries. The SDK now automatically aggregates them into a single Entitlement object per feature:- Numeric fields (
usageLimit,currentUsage,remaining) are summed across all entries hasAccessistrueif any raw entry grants accesshardLimitistrueif any entry sets it- All raw entries are preserved in the
.items[]array
Entitlement Interface
New type representing an aggregated entitlement with an items: EntitlementDetail[] field containing the raw entries that were aggregated.getRawEntitlement({ customerId, featureId })
Returns the raw API response for a specific feature (CheckEntitlementsResponse with customerId wrapper), without any aggregation:getRawEntitlements({ customerId })
Returns the raw API response for all entitlements, without any aggregation:client.subscription Deprecated Alias
A backward-compatible getter that maps client.subscription to client.subscriptions, so existing code continues to work during migration.Breaking Changes
client.subscription Renamed to client.subscriptions
The subscriptions module now uses the plural form for consistency with other modules (client.customers, client.entitlements, etc.):client.subscription accessor still works as a deprecated alias.getEntitlement() Returns Entitlement | null
Previously returned CheckEntitlementsResponse (the raw API shape with a customerId wrapper). Now returns a single aggregated Entitlement object with an .items[] array, or null if the feature is not found:getRawEntitlement().getAllEntitlements() Removed
Replaced by getEntitlements(), which returns Record<string, Entitlement> — a record keyed by featureId with aggregated values and an .items[] array:getRawEntitlements().FeatureType Changed: "LIMIT" → "CUSTOMIZABLE"
The FeatureType union no longer includes "LIMIT". Update any code that matches on this value:resetAt Removed from Aggregated Entitlement
Since resetAt can differ across subscriptions, it is only available on individual items:Fixed
- Fixed Python-style
try/exceptsyntax in subscription update documentation — replaced with JavaScripttry...catch. - Added missing
try/catcherror handling to subscription cancel documentation example. - Removed invalid JSON comments (
// Server-generated UUID) from documentation response blocks. - Fixed trailing comma in checkout session JSON response example.
- Fixed
"Node SDK Use"typo →"Node SDK User"in create customer documentation. - Fixed
True→true,bool→booleaninhasAccessdocumentation. - Replaced “Pydantic model” references with “TypeScript Interface” or “Object”.
- Replaced “Dictionary” with “Object” in parameter descriptions.
- Fixed Python-style
ACCESS_TOKEN = "..."→const ACCESS_TOKEN = "...";in setup example.