User Generated Events
Closing the paywall
If the close button is visible and the user presses it, this method will be invoked:
public func paywallControllerDidPressCloseButton(_ controller: AdaptyPaywallController) {
controller.dismiss(animated: true)
}
Canceled purchase
If the user initiates the purchase process but manually interrupts it, this function will be called. Basically, this event occurs when the Adapty.makePurchase()
function completes with a .paymentCancelled
error:
public func paywallControllerDidCancelPurchase(_ controller: AdaptyPaywallController) {
}
Successful purchase
If Adapty.makePurchase()
succeeds, this method will be invoked:
public func paywallController(_ controller: AdaptyPaywallController,
didFinishPurchaseWith profile: AdaptyProfile) {
controller.dismiss(animated: true)
}
We recommend to dismiss the screen in that case.
Failed purchase
If Adapty.makePurchase()
fails, this method will be invoked:
public func paywallController(_ controller: AdaptyPaywallController,
didFailPurchaseWith error: AdaptyError) {
}
Successful restore
If Adapty.restorePurchases()
succeeds, this method will be invoked:
func paywallController(_ controller: AdaptyPaywallController, didFinishRestoreWith profile: AdaptyProfile) {
if profile.accessLevels["premium"]?.isActive ?? false {
controller.dismiss(animated: true)
}
}
We recommend to dismiss the screen if the user has the required accessLevel.
Failed restore
If Adapty.restorePurchases()
fails, this method will be invoked:
public func paywallController(_ controller: AdaptyPaywallController, didFailRestoreWith error: AdaptyError) {
}
Updated about 2 months ago