setSubscriptionStatus()
A function that manually sets the subscription status when using a custom PurchaseController.
This function should only be used when implementing a custom PurchaseController
. When using Superwall's built-in purchase handling, the subscription status is managed automatically.
You must call this function whenever the user's entitlements change to keep Superwall's subscription status synchronized with your purchase system.
Purpose
Manually updates the subscription status when using a custom PurchaseController
to ensure paywall gating and analytics work correctly.
Signature
Parameters
Name | Type | Description |
---|---|---|
status | SubscriptionStatus | The subscription status to set. Can be SubscriptionStatus.Unknown , SubscriptionStatus.Active(entitlements) , or SubscriptionStatus.Inactive . |
Returns / State
This function returns Unit
. The new status will be reflected in the subscriptionStatus
StateFlow and will trigger the SuperwallDelegate.subscriptionStatusDidChange
callback.
Usage
Set active subscription with entitlements:
Set inactive subscription:
Set unknown status during initialization:
Usage with RevenueCat:
Listen for external subscription changes:
Java usage:
How is this guide?