Subscription Services

The subscription services APIs provide functionality to manage subscriptions, assign devices, check free trial eligibility, preview activation, and retrieve subscription pricing details.

Pre-requisite: The user has to be signed in to perform the following operations.


Get Subscriptions

To fetch all subscriptions associated with a space, The following method can be used:

  • spaceId (Required): The space ID of the User.
Factory.subscriptionService.getSubscriptions(
        spaceId: String
    ) -> IVPublisher<[SubscriptionDataModel]>

Manage Subscribed Devices

To associate or updates devices linked to a subscription, The following method can be used:

  • subscriptionId (Required): The ID of the subscription.
  • deviceIds (Required): Device Ids to be associated with the subscription.
Factory.subscriptionService.manageSubscribedDevices(
        subscriptionId: String,
        deviceIds: SubscribeDeviceRequest
) -> IVPublisher<Void>

Check Free Trial

To check whether a product is eligible for a free trial, The following method can be used:

  • productId (Required): The Product Id. like HomeSecurity, Bird, Pet etc.
Factory.subscriptionService.checkFreeTrail(
        productId: String
    ) -> IVPublisher<FreeTrialResponse>

Cancel Subscription

To cancel an active subscription, The following method can be used:

  • subscriptionId (Required): The ID of the subscription.
Factory.subscriptionService.cancelSubscription(
        subscriptionId: String
    ) -> IVPublisher<Void>

Activate Subscription Preview

To activate subscription preview, The following method can be used:

  • spaceId (required): The id of the space.
  • request (required): The subscription preview information.
Factory.subscriptionService.activateSubscriptionPreview(
        spaceId: String,
        request: SubscriptionPreviewRequest
    ) -> IVPublisher<Void>

Get Subscription Prices

To fetch pricing preview for subscription products, The following method can be used:

  • country (required): Country code for localized pricing.
  • productIds (required): List of product identifiers.
  • skuCategories (required): SKU category for filtering subscription pricing.
Factory.subscriptionService.getSubscriptionPrices(
        country: String,
        productIds: [String],
        skuCategories: SkuCategory
    ) -> IVPublisher<[SubscriptionPricePreviewResponse]>