PurchaseController
An interface for handling Superwall's subscription-related logic with your own purchase implementation.
This interface is not required. By default, Superwall handles all subscription-related logic automatically using Google Play Billing.
When implementing PurchaseController, you must manually update subscriptionStatus
whenever the user's entitlements change.
Purpose
Use this interface only if you want complete control over purchase handling, such as when using RevenueCat or other third-party purchase frameworks.
Signature
Parameters
Method | Parameters | Return Type | Description |
---|---|---|---|
purchase | activity: Activity , product: StoreProduct | PurchaseResult | Called when user initiates purchasing. Implement your purchase logic here. Activity is needed for Google Play Billing. |
restorePurchases | None | RestorationResult | Called when user initiates restore. Implement your restore logic here. |
Returns / State
purchase()
returns aPurchaseResult
(.Purchased
,.Failed(Throwable)
,.Cancelled
, or.Pending
)restorePurchases()
returns aRestorationResult
(.Restored
or.Failed(Throwable?)
)
When using a PurchaseController, you must also manage subscriptionStatus
yourself.
Usage
For implementation examples and detailed guidance, see Using RevenueCat.
How is this guide?