Changelog
v5.0.0
Breaking Changes
The Salable class has been replaced with a new initSalable function. Using the new initialise function will enable
vendors to use v2 or v3 of the API within the same version of the SDK.
v4.0.0 implementation
const salable = new Salable('your-api-key', 'v2');
v5.0.0 implementation
const salableV2 = initSalable('your-api-key', 'v2'); // v2 still supported
const salableV3 = initSalable('your-api-key', 'v3');
V3 Breaking changes
Capabilities deprecated
Capabilities used to be stored on the License at the point of creation with no way of editing them. We found this to be too rigid, for flexibility we have deprecated capabilities in favour of using the plan's feature values which are editable in the Salable app.
Deprecated methods that use capabilities
Capabilities deprecated
Capabilities used to be stored on the License at the point of creation with no way of editing them. Instead, we have now opted to use the plan's features which allow you to update a grantee’s access on-the-fly through the Salable dashboard.
Deprecated capabilities deprecated
plans.capabilitiesproducts.capabilitieslicenses.check
Licenses deprecated
All license methods have been deprecated in favour of managing them through the subscription instead. This gives a consistent implementation across all types of subscriptions.
licenses.createmoved tosubscriptions.create- theownervalue will be applied to thepurchaserfield of the license.licenses.checkmoved toentitlements.checklicenses.getAllmoved tosubscriptions.getSeatslicenses.getOnesupport removed - fetch the parent subscription instead usingsubscriptions.getOnelicenses.getForPurchasermoved tosubscriptions.getAllwith the owner filter applied.licenses.updatemoved tosubscriptions.update- To update a seat's grantee use the
subscriptions.manageSeatsmethod.
- To update a seat's grantee use the
licenses.updateManymoved tosubscriptions.manageSeatslicenses.getCountmoved tosubscriptions.getSeatCountlicenses.cancelmoved tosubscriptions.cancel- this will cancel all the subscription's child licenses.licenses.cancelManymoved tosubscriptions.cancel- it is not possible to cancel many subscriptions in the same request.
Other deprecated endpoints
products.getFeaturesmoved tofeatures.getAllwith theproductUuidfilter applied.products.getPlansmoved toplans.getAllwith theproductUuidfilter applied.subscriptions.addSeatsmoved tosubscriptions.updateSeatCountwithincrementset.subscriptions.removeSeatsmoved tosubscriptions.updateSeatCountwithdecerementset.
Affected responses
products.getAllnow uses cursor-based pagination in the response.
What's new?
New methods
features.getAll- Retrieves all features for an organisation. The response uses cursor-based pagination.plans.getAll- Retrieves all plans for an organisation. The response uses cursor-based pagination.subscriptions.updateSeatCount- v2 of the API required two different endpoints to add and remove seats on a per-seat subscription. In v3 this has been aligned under one methodsubscriptions.updateSeatCount.entitlements.check- Check grantee access to specific features (replaceslicenses.check).
v4.0.0 SDK with API v2
const salable = new Salable('your-api-key', 'v2');
const check = await salable.licenses.check({
productUuid: 'your-product-uuid',
granteeIds: ['your-grantee-id'],
});
const hasAccess = check?.capabilities.find((c) => c.capability === 'your-boolean-feature');
v5.0.0 SDK with API v3
const salable = initSalable('your-api-key', 'v3');
const check = await salable.entitlements.check({
productUuid: 'your-product-uuid',
granteeIds: ['your-grantee-id'],
});
const hasAccess = check.features.find((f) => f.feature === 'your-boolean-feature');
v4.0.0
Breaking Changes
- Salable API versions are now supported and
Versionis now a required argument uponSalableinstantiation. (Currently supportsv2)- Support for
v1of the Salable API has been deprecated
- Support for
Licenses
getAllnow supports cursor based pagination, licenses can also be filtered bystatus,subscriptionUuid,planUuid,productUuid, andgranteeIdgetOneandgetForGranteeIdnow offer anexpandoption to expand certain properties (e.g.planetc)getForPurchaserno longer offerscancelLinkas an optiongetUsagehas been deprecatedcreateandcreateManyare now separate methods,statusandendTimehave been added as optional parametersupdatemethod parameters have been changed to have an object as the second parameter, thegranteeIdproperty is where the grantee ID value can be assignedcancelManymethod parameter has been updated to be an object, theuuidsproperty is where an array of license UUIDs to cancel can be assignedverifyLicenseCheckhas been renamed toverify
Plans
getOnenow offers anexpandoption to expand certain properties (e.g.productetc)getCheckoutLinkoptions have now been updated:vatis no longer supported and has been deprecatedcustomerhas been deprecated and been replaced withcustomerIdandcustomerEmailcontactUsLinkhas been deprecatedmarketingConsenthas been deprecatedcouponCodehas been deprecatedcustomMessagehas been deprecatedautomaticTax,changeQuantity, andrequirePaymentMethodhave been added
Pricing Tables
getOneoptions have been updated. The only supported options are nowgranteeIdandcurrency
Products
getOnenow offers anexpandoption to expand certain properties (e.g.planetc)getPricingTableoptions have been updated. The only supported options are nowgranteeIdandcurrency
Subscriptions
getOnenow offers anexpandoption to expand certain properties (e.g.planetc)getAllmethod added. Retrieves a list of all subscriptionsgetInvoicesmethod added. Retrieves a list of invoices for a subscriptiongetSwitchablePlansmethod added. Retrieves a list of available plans that a subscribed user can switch togetUpdatePaymentLinkmethod added. Retrieves the update payment portal link for a specific subscriptiongetPortalLinkmethod added. Retrieves the customer portal link for a subscriptiongetCancelSubscriptionLinkmethod added. Retrieves the cancel subscription portal link for a specific subscriptiongetPaymentMethodmethod added. Retrieves the payment method used to pay for a subscriptionreactivateSubscriptionmethod added. Reactivate a Subscription's scheduled cancellation before the billing period has passedupdatePlanmethod has been deprecatedaddSeatsandremoveSeatsnow optionally allow proration as an option
Usage (NEW)
getAllUsageRecordsgets all usage records for grantee's metered licensesgetCurrentUsageRecordgets current usage record for grantee on planupdateLicenseUsageupdates a license's usage
RBAC (DEPRECATED)
- All RBAC methods have been deprecated and currently not supported by the SDK
Other Changes
- DOCS: JSDoc and SDK documentation have been updated
- interfaces have been replaced with types
403and404errors now specifically handled
v3.2.0
Licenses
- Added
getOne,getForPurchaser,getForGranteeId,getUsage&getCountlicenses methods to SDK.
v3.1.0
Licenses
- Added
getOne,getForPurchaser,getForGranteeId,getUsage&getCountlicenses methods to SDK.
v3.0.0
Error handling
- Added new Error classes
SalableResponseError,SalableValidationErrorandSalableUnknownError - New error codes
More information on error handling
v2.8.0
Subscriptions
- Added
changePlansubscriptions method to SDK.
Pricing Tables
- Added
getOnepricing tables method to SDK.
v2.7.0
Licenses
- Added
update,updateMany&getCountlicenses methods to SDK.
v2.6.0
Subscriptions
- Added
addSeats&removeSeatssubscription methods to SDK.
v2.5.0
Features
- Added
Products(getOne,getCheckoutLink,getFeatures,getCapabilities,getCurrencies) methods to SDK.
v2.4.0
Features
- Added
plans(getOne,getCheckoutLink,getFeatures,getCapabilities,getCurrencies) methods to SDK.
Other Changes
- DOCS: Updated links to resources object documentation
v2.3.0
Features
- Added URL support in constructor for passing API URL
v2.2.0
Features
- Added
cancelsubscription method to SDK.
v2.1.0
Features
- Added
rbac(permissions,users,roles) methods to SDK.
Other Changes
- DOCS: Updated documentation mistakes and inaccuracies
v2.0.0
Breaking Changes
- Top level export
SalableApirenamed toSalable getLicenses()renamed togetAll()createLicense()renamed tocreate()checkLicenses()renamed tocheck()getSubscription()renamaed togetOne()changePlan()renmaed toupdatePlan()updateUsage()renamed toupdate()
Other Changes
- DOCS: JSDoc documentation added to all methods for each class
- FEAT: Updated internal
_requestmethod to support TS Generics for return and argument types - CHORE: Restructured repository contents so endpoints aren't contained inside a
third-party-apifolder.