SDK Reference - getActiveProducts
The getActiveProducts method retrieves all subscriptions or non-consumables owned by the user. If your app includes subscription sales, this method is essential for checking whether the user has an active subscription.
However, if you synchronize your server with IAPHUB using webhooks, you can directly query your server instead, eliminating the need for this method.
By default, the getActiveProducts method only returns subscriptions with an 'active' or 'grace_period' state.
If the includeSubscriptionStates option is specified, you can also retrieve subscriptions in a 'paused' or 'retry_period' state.
This option can be useful if you need to display a message regarding these states.
If the request fails due to a network issue, the method returns the latest data cached (if available) with no expired subscription; otherwise, an error is thrown.
If an active product is returned by the IAPHUB API, but the product SKU cannot be loaded (due to Apple/Google not returning it), the product will still be returned. However, only the properties coming directly from the API will be included. Properties such as localizedTitle, localizedDescription, localizedPrice, price, currency, etc., will not be returned in this case.
Example
var activeProducts = await Iaphub.getActiveProducts();
Parameters
Response
type
Valuesplatform
ValuessubscriptionDuration
Valuestype
ValuescycleDuration
ValuessubscriptionState
ValuessubscriptionPeriodType
Values