Product Catalog
Pre-requisite:
- The user has to be signed in to perform the following operations.
Get Products (Deprecated)
To retrieve product plans by country and product IDs, use the following method:
Deprecated
This method is deprecated. Use the newgetProductsmethod withskuCategoriesfor more flexible product retrieval.
country(required): The ISO country code (e.g., “US”, “IN”) for which products should be fetched.productIds(required): Comma-separated product IDs to filter the results.
InstaVision.subscriptionServices.getProducts(
country = "IN",
productIds = "product_basic, product_pro",
onSuccess = { plans ->
// Handle the list of available plans (List)
},
onError = { error ->
// The error object contains the error code and message
}
)
Get Products
To retrieve product plans by country, product IDs and sku categories use the following method:
country(required): The ISO country code (e.g., “US”, “IN”) for which products should be fetched.productIds(required): Comma-separated product IDs to filter the results.skuCategories(required): Comma-separated category of products to fetch (e.g., “AI”, “Combo”, “Data”).
InstaVision.subscriptionServices.getProducts(
country = "IN",
productIds = "product_basic, product_pro",
skuCategories = "AI, Combo",
onSuccess = { plans ->
// Handle the list of available plans (List)
},
onError = { error ->
// The error object contains the error code and message
}
)
The plan and its scope
getProducts returns a flat list of Plans; each plan names the product it belongs to in productId. A plan’s scope says what the subscription applies to, matching a SubscriptionScope value (fromValue is an exact, case-sensitive match):
Product: the plan covers a single product.Space: the plan covers everything in a space.
Use SubscriptionScope.fromValue(...) to turn the string into the enum. A plan’s productId is nullable, and is absent for a plan whose scope is Space.
A plan also carries trialPeriod, the number of trial days offered with it. A value of 0 means the plan has no trial.