Subscription Management

Pre-requisite

  • The user has to be signed in to perform the following operations.

Get Subscriptions

To retrieve all active subscriptions for a given space, use the following method:

  • spaceId (required): The unique identifier of the space.
InstaVision.subscriptionService.getSubscriptions(
  spaceId = "spaceId",
  onSuccess = { subscriptions ->
// Handle the list of subscriptions
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

Cancel Subscription

To cancel an existing subscription, use the following method:

  • subscriptionId (required): The unique ID of the subscription.
InstaVision.subscriptionService.cancelSubscription(
  subscriptionId = "subscriptionId",
  onSuccess = {
    // Subscription cancelled successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

Activate Subscription Preview

To activate a subscription currently in preview mode, use the following method:

  • spaceId (required): The unique identifier of the space.
  • subscriptionPreviewRequest (required): The request object containing preview activation details.
val previewRequest = SubscriptionPreviewRequest(
  skuId = "skuId", // The SKU ID of the subscription
)
InstaVision.subscriptionService.activateSubscriptionPreview(
  spaceId = "spaceId ",
  subscriptionPreviewRequest = previewRequest,
  onSuccess = {
    // Subscription preview activated successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)