Skip to main content

Subscriptions & Entitlements

Getting Subscription Entitlements​

Returns the raw JSON entitlement string for the specified subscription id.

getSubscriptionEntitlements(subscriptionId: String) throws -> String

subscription_id: The ID of the Subscription Receipt Token for which you want to fetch entitlements in raw JSON format.
Returns: Returns an error if there is a problem fetching the token, or the raw JSON string containing all entitlements of that token.

Listing all available Entitlement Names​

Sometimes it's helpful, to know all available entitlement names without the properties of each entitlement. This allows to check, if a certain feature is available without parsing the full JSON string which you can get from get_subscription_entitlement.

list_entitlement_names(subscription_id: Option<String>) -> Result<Vec<String>

subscription_id: If not provided, it will return all unique entitlement names for all subscription tokens in the cache. If provided, it will only return the entitlement names for the specific subscription.

Returns: An error if there was a problem to fetch the entitlements or an array of entitlement names

Searching for a specific Entitlement​

To verify a user's access to a specific entitlement, use this method. If the entitlement exists, it will return the subscription ID containing that entitlement. This is useful for identifying which subscription corresponds to a particular feature, such as determining the VPN subscription by checking which subscription ID includes the <brand>.vpn entitlement.

search_entitlement(entitlement_name: String>) -> Result<Vec<String>

entitlement_name: The name of the entitlement to search.

Returns: An error if there was a problem to fetch the entitlements or an array of subscription ids, which contain the entitlement.