Handle flow & paywall events - React Native
This guide covers event handling for purchases, restorations, product selection, and flow rendering. You can also set up button handling (closing the flow, opening links, custom actions, etc.). See our guide on handling button actions for details.
Flows and paywalls built in the Flow & Paywall Builder don’t need extra code to make and restore purchases. However, they generate some events that your app can respond to. Those events include button presses (close buttons, URLs, product selections, and so on) as well as notifications on purchase-related actions taken on the flow. Learn how to respond to these events below.
To control or monitor processes occurring on the flow screen within your mobile app, implement event handlers:
For React component, you handle events through individual event handler props in the AdaptyFlowView component:
import React, { useCallback } from 'react';
import { AdaptyFlowView, adapty } from 'react-native-adapty';
import type { FlowEventHandlers } from 'react-native-adapty';
function MyFlow({ flow }) {
const onCloseButtonPress = useCallback<FlowEventHandlers['onCloseButtonPress']>(() => {}, []);
const onProductSelected = useCallback<FlowEventHandlers['onProductSelected']>((productId) => {}, []);
const onPurchaseStarted = useCallback<FlowEventHandlers['onPurchaseStarted']>((product) => {}, []);
const onPurchaseCompleted = useCallback<FlowEventHandlers['onPurchaseCompleted']>((purchaseResult, product) => {}, []);
const onPurchaseFailed = useCallback<FlowEventHandlers['onPurchaseFailed']>((error, product) => {}, []);
const onRestoreStarted = useCallback<FlowEventHandlers['onRestoreStarted']>(() => {}, []);
const onRestoreCompleted = useCallback<FlowEventHandlers['onRestoreCompleted']>((profile) => {}, []);
const onRestoreFailed = useCallback<FlowEventHandlers['onRestoreFailed']>((error) => {}, []);
const onAppeared = useCallback<FlowEventHandlers['onAppeared']>((view) => {}, []);
const onError = useCallback<FlowEventHandlers['onError']>((error) => {}, []);
const onLoadingProductsFailed = useCallback<FlowEventHandlers['onLoadingProductsFailed']>((error) => {}, []);
const onUrlPress = useCallback<FlowEventHandlers['onUrlPress']>((url, openIn) => {
adapty.openWebUrl(url, openIn);
return false;
}, []);
const onCustomAction = useCallback<FlowEventHandlers['onCustomAction']>((actionId) => {}, []);
const onWebPaymentNavigationFinished = useCallback<FlowEventHandlers['onWebPaymentNavigationFinished']>(() => {}, []);
return (
<AdaptyFlowView
flow={flow}
style={styles.container}
onCloseButtonPress={onCloseButtonPress}
onProductSelected={onProductSelected}
onPurchaseStarted={onPurchaseStarted}
onPurchaseCompleted={onPurchaseCompleted}
onPurchaseFailed={onPurchaseFailed}
onRestoreStarted={onRestoreStarted}
onRestoreCompleted={onRestoreCompleted}
onRestoreFailed={onRestoreFailed}
onAppeared={onAppeared}
onError={onError}
onLoadingProductsFailed={onLoadingProductsFailed}
onUrlPress={onUrlPress}
onCustomAction={onCustomAction}
onWebPaymentNavigationFinished={onWebPaymentNavigationFinished}
/>
);
}Event examples (Click to expand)
// onCloseButtonPress
{
//Record the event
}
// onAndroidSystemBack
{
//Record the event
}
// onUrlPress
{
"url": "https://example.com/terms"
}
// onCustomAction
{
"actionId": "login"
}
// onProductSelected
{
"productId": "premium_monthly"
}
// onPurchaseStarted
{
"product": {
"vendorProductId": "premium_monthly",
"localizedTitle": "Premium Monthly",
"localizedDescription": "Premium subscription for 1 month",
"price": {
"amount": 9.99,
"currencyCode": "USD",
"currencySymbol": "$",
"localizedString": "$9.99"
}
}
}
// onPurchaseCompleted - Success
{
"purchaseResult": {
"type": "success",
"profile": {
"accessLevels": {
"premium": {
"id": "premium",
"isActive": true,
"expiresAt": "2024-02-15T10:30:00Z"
}
}
}
},
"product": {
"vendorProductId": "premium_monthly",
"localizedTitle": "Premium Monthly",
"localizedDescription": "Premium subscription for 1 month",
"price": {
"amount": 9.99,
"currencyCode": "USD",
"currencySymbol": "$",
"localizedString": "$9.99"
}
}
}
// onPurchaseCompleted - Cancelled
{
"purchaseResult": {
"type": "user_cancelled"
},
"product": {
"vendorProductId": "premium_monthly",
"localizedTitle": "Premium Monthly",
"localizedDescription": "Premium subscription for 1 month",
"price": {
"amount": 9.99,
"currencyCode": "USD",
"currencySymbol": "$",
"localizedString": "$9.99"
}
}
}
// onPurchaseFailed
{
"error": {
"code": "purchase_failed",
"message": "Purchase failed due to insufficient funds",
"details": {
"underlyingError": "Insufficient funds in account"
}
},
"product": {
"vendorProductId": "premium_monthly",
"localizedTitle": "Premium Monthly",
"localizedDescription": "Premium subscription for 1 month",
"price": {
"amount": 9.99,
"currencyCode": "USD",
"currencySymbol": "$",
"localizedString": "$9.99"
}
}
}
// onRestoreCompleted
{
"profile": {
"accessLevels": {
"premium": {
"id": "premium",
"isActive": true,
"expiresAt": "2024-02-15T10:30:00Z"
}
},
"subscriptions": [
{
"vendorProductId": "premium_monthly",
"isActive": true,
"expiresAt": "2024-02-15T10:30:00Z"
}
]
}
}
// onRestoreFailed
{
"error": {
"code": "restore_failed",
"message": "Purchase restoration failed",
"details": {
"underlyingError": "No previous purchases found"
}
}
}
// onError
{
"error": {
"code": "rendering_failed",
"message": "Failed to render flow interface",
"details": {
"underlyingError": "Invalid flow configuration"
}
}
}
// onLoadingProductsFailed
{
"error": {
"code": "products_loading_failed",
"message": "Failed to load products from the server",
"details": {
"underlyingError": "Network timeout"
}
}
}
// onAppeared
{
"view": {
"id": "3f8a1c7e-9b24-4d51-8e30-6c5b2a9f1d47",
"placementId": "onboarding_paywall",
"variationId": "d21c4b6a-57e8-4f39-b0a2-8c7e13f5d94b",
"locale": "es"
}
}
// onDisappeared
{
//Record the event
}
// onWebPaymentNavigationFinished
{
//Record the event
}You can register event handlers you need, and miss those you do not need. In this case, unused event listeners would not be created. There are no required event handlers.
Event handlers return a boolean. In modal presentation, if true is returned, the displaying process is considered complete, thus the flow screen closes, event listeners for this view are removed, and the native view is destroyed, even if you kept it earlier with destroy: false. In an embedded AdaptyFlowView, the returned value is ignored: to close the flow, stop rendering the component.
Some event handlers have a default behavior that you can override if needed:
onCloseButtonPress: closes the flow when close button pressed.onUrlPress: opens the tapped URL and keeps the flow open.onAndroidSystemBack(only for modal presentation): keeps the flow open when the Back button is pressed. Returntrueto close it.onRestoreCompleted: keeps the flow open after a successful restore. Returntrueto close it.onPurchaseCompleted: keeps the flow open after a purchase completes. Returntrueto close it.onError: closes the flow if its rendering fails.
Event handlers
| Event handler | Description |
|---|---|
| onCustomAction | Invoked when a custom action runs, for example, when a user taps a button with this action. The second parameter of onCustomAction, args, is reserved for future Flow & Paywall Builder capabilities, so you don’t need to read it. |
| onUrlPress | Invoked when a user clicks a URL in your flow. |
| onAndroidSystemBack | Modal presentation only: Invoked when a user taps the system Android Back button. |
| onCloseButtonPress | Invoked when the close button is visible and a user taps it. It is recommended to dismiss the flow screen in this handler. |
| onPurchaseCompleted | Invoked when the purchase completes, whether successful, cancelled by user, or pending approval. In case of a successful purchase, it provides an updated AdaptyProfile. User cancellations and pending payments (e.g., parental approval required) trigger this event, not onPurchaseFailed. |
| onPurchaseStarted | Invoked when a user taps the “Purchase” action button to start the purchase process. |
| onPurchaseFailed | Invoked when a purchase fails due to errors (e.g., payment restrictions, invalid products, network failures, transaction verification failures). Not invoked for user cancellations or pending payments, which trigger onPurchaseCompleted instead. |
| onRestoreStarted | Invoked when a user starts a purchase restoration process. |
| onRestoreCompleted | Invoked when purchase restoration succeeds and provides an updated AdaptyProfile. To show users more screens after a purchase restoration, such as a welcome-back screen, set up outcome actions in the Flow & Paywall Builder. Use app code for what the flow can’t do, such as opening a screen of your app once the user has access. Refer to the Subscription status topic to learn how to verify the access level. |
| onRestoreFailed | Invoked when the restore process fails and provides AdaptyError. |
| onProductSelected | Invoked when any product in the flow view is selected, allowing you to monitor what the user selects before the purchase. |
| onError | Invoked when an error occurs in the flow. The handler receives the error as an AdaptyError object. For example, when the flow script throws an exception, the error has the jsException code. The handler also receives an error when an embedded AdaptyFlowView can’t show its flow. This happens when the flow fails to load, or when the device runs iOS 15, which flows don’t support. |
| onLoadingProductsFailed | Invoked when product loading fails and provides AdaptyError. If you haven’t set prefetchProducts: true in view creation, AdaptyUI will retrieve the necessary objects from the server by itself. |
| onAppeared | Invoked when the flow is displayed to the user, and provides the view that appeared — see The view argument. On iOS, also invoked when a user taps the web paywall button inside a flow, and a web paywall opens in an in-app browser. |
| onDisappeared | Modal presentation only: Invoked when the flow is closed by the user. On iOS, also invoked when a web paywall opened from a flow in an in-app browser disappears from the screen. |
| onWebPaymentNavigationFinished | Invoked after attempting to open a web paywall for purchase, whether successful or failed. |
| onAnalytics | Invoked when a flow reports an analytics event, such as a screen view. See Analytics events below. |
| onRequestAppReview | Reserved for app-review requests from a flow. Flows don’t trigger app-review requests yet, so you don’t need to implement it. |
| onRequestPermission | Invoked when a flow runs the Request permission action. Asynchronous: request the permission, then resolve the promise of the handler with { status: 'granted' } if the user granted the permission, and with { status: 'denied', detail: 'denied' } if the user declined it. If you don’t set this handler, the user never sees the system permission dialog, and the flow runs the After response actions, not the When allowed or When denied actions. See Handle permission requests in flows. |
| onObserverPurchaseInitiated | Observer mode only: Invoked when a user taps the purchase button in a flow. Adapty does not make the purchase — perform it with your own purchase code, then report the transaction to Adapty. See Handle purchases in observer mode below. |
| onObserverRestoreInitiated | Observer mode only: Invoked when a user taps the restore button in a flow. Adapty does not restore — perform it yourself, then report any restored transactions. See Handle purchases in observer mode below. |
The view argument
The view argument requires React Native SDK 4.0.3 or later. Of all the flow handlers, only onAppeared receives a description of the view itself — a FlowEventView object with these fields:
| Field | Description |
|---|---|
| id | The identifier of this view instance. It is internal to the SDK and matches nothing in the Adapty dashboard. |
| placementId | The placement the flow was fetched for. |
| variationId | The variation the flow resolved to, for attributing your own analytics to an A/B test. |
| locale | The flow localization the view was built with. It differs from the locale you requested when the flow has no such localization. Read it to align the rest of your screen with the language the flow rendered in. See Use localizations and locale codes. |
Analytics events
const unsubscribe = view.setEventHandlers({
onAnalytics(name, params) {
return false; // keep the flow open
},
});The flow sends the following analytics events to your app:
| Event | The flow sends the event when |
|---|---|
flow_screen_showed | The user opens a screen of the flow |
flow_user_input | An input or a selectable group reports its value. See the list under this table |
flow_permission_requested | The flow sends a permission request to your app |
flow_permission_answered | Your app passes the result of a permission request to the flow |
flow_permission_unanswered | Your app passes no result to the flow within 60 seconds after a permission request |
Timing of input events
The flow sends flow_user_input at the following moments:
- Text, Number, Phone number, and E-mail inputs: When the input loses focus after a change.
- Date, Time, and Date & Time inputs: When the picker closes with a new value.
- Single choice, Multi-choice, and Toggle groups: Right after each tap.
- Number picker: When one of the following happens on the screen with the Number picker, even if the user never turned the wheel:
- A Navigate to Screen, Navigate Next, or Navigate back action leaves this screen.
- The user taps an option or a toggle.
A flow also reports the values users type and select. See Process data from flows to read them.
Screen view events
A flow reports flow_screen_showed every time a user opens one of its screens. Adapty counts these events in its own flow analytics and delivers them to your app as well, so you can build the same funnel in your own analytics.
| Parameter | Description |
|---|---|
instanceId | The ID of the screen the user opened. |
screen_order | The screen’s position in the flow. |
is_last_screen | true when the screen has nowhere further to go. A branching flow can end on several different screens, and each one reports true. A paywall screen reports false if any of its outcome actions navigates to another screen, whatever the purchase or restoration result. A Navigate back action doesn’t count. A navigation to a screen doesn’t count either if all users see that screen before the paywall. |
Both isBackendEvent and isCustomerEvent are true on this event: Adapty keeps counting it, and your app receives it too.
To forward screen views to your product analytics, follow Track flow screen views.
Permission request events
For a flow that requests system permissions, the permission events show how many users grant each permission.
For each permission request, the flow sends the following events to the analytics callback in your app:
flow_permission_requested: The flow sent the permission request to your app. While the flow waits for the result of a request, it sends no other request and no event for one. Its parameters:instanceId: The ID of the screen that sent the request.permission: The permission value.with_outcome:trueif When allowed, When denied, or After response triggers an action other than Do nothing.
flow_permission_answered: Your app passed the result to the flow. Its parameters:instanceId: The ID of the screen that sent the request.permission: The permission value.result:trueif your app passed a granted result.detail_result: The argument that your app passed with the result, if any.outcome: One value for the result and its argument, fromresultanddetail_result. See the table under this list.
flow_permission_unanswered: Your app didn’t pass a result within 60 seconds after the permission request. The flow sends this event once per request. It doesn’t send the event if the flow was closed before then. If your app passes the result later, the flow still sendsflow_permission_answered. Its parameters:instanceId: The ID of the screen that sent the request. When theoutcomeparameter isleft_screen, the ID still belongs to that screen, not to the screen the user is on.permission: The permission value.with_outcome:trueif When allowed, When denied, or After response triggers an action other than Do nothing.outcome:on_screenif the user is still on the screen that sent the request, orleft_screenif the user left that screen. If the user left the screen and came back to it within the 60 seconds, the outcome ison_screen.
The outcome property of flow_permission_answered reports the result that your app passed, not the actions that the flow ran:
| Result and the argument that your app passed | outcome |
|---|---|
Granted, with limited or provisional | The same argument: limited or provisional |
| Granted, with any other argument or without one | granted |
Not granted, with denied, restricted, permanently_denied, or unsupported | The same argument: denied, restricted, permanently_denied, or unsupported |
| Not granted, with any other argument | other |
| Not granted, without an argument. Some Adapty SDKs pass this result when your app has no handler | no_status |
When you test the permission request, compare the events with what you selected in the system dialog. If they differ, find the cause in the following list:
outcomeisno_status, but you declined the permission: Your app passed a not-granted result without thedeniedargument. Pass thedeniedargument with the result.outcomeisother: Your app passed the result with an argument that the flow doesn’t know, for example a typo or an error message. Thedetail_resultparameter shows this argument.- The flow sends
flow_permission_unanswered: Your app passed no result within 60 seconds. Set up the handler for the flow, and pass a result for every permission request, even after an exception or a timeout.
Handle purchases in observer mode
If you activated the SDK in Observer mode (observerMode: true) and present an Adapty-rendered flow, the SDK does not make purchases for you. When a user taps the purchase or restore button, the SDK invokes onObserverPurchaseInitiated or onObserverRestoreInitiated instead. Perform the purchase or restore with your own code, drive the flow’s loading indicator with the provided callbacks, and report the transaction to Adapty afterwards.
const unsubscribe = view.setEventHandlers({
onObserverPurchaseInitiated(product, onStartPurchase, onFinishPurchase) {
onStartPurchase(); // show the flow's loading indicator
myPurchaseApi(product.vendorProductId)
.then((transactionId) => adapty.reportTransaction(transactionId))
.finally(() => onFinishPurchase()); // hide the loading indicator
return false; // keep the flow open; dismiss it yourself after success, or let the flow continue
},
onObserverRestoreInitiated(onStartRestore, onFinishRestore) {
onStartRestore();
myRestoreApi()
.finally(() => onFinishRestore());
return false;
},
});This guide covers event handling for purchases, restorations, product selection, and paywall rendering. You must also implement button handling (closing paywall, opening links, etc.). See our guide on handling button actions for details.
Paywalls configured with the Paywall Builder don’t need extra code to make and restore purchases. However, they generate some events that your app can respond to. Those events include button presses (close buttons, URLs, product selections, and so on) as well as notifications on purchase-related actions taken on the paywall. Learn how to respond to these events below.
This guide covers only paywalls built in the old builder, which require Adapty SDK v3.0 or later.
To control or monitor processes occurring on the paywall screen within your mobile app, implement event handlers:
For React component, you handle events through individual event handler props in the AdaptyPaywallView component:
import React, { useCallback } from 'react';
import { Linking } from 'react-native';
import { AdaptyPaywallView } from 'react-native-adapty';
import type { EventHandlers } from 'react-native-adapty';
function MyPaywall({ paywall }) {
const onCloseButtonPress = useCallback<EventHandlers['onCloseButtonPress']>(() => {}, []);
const onProductSelected = useCallback<EventHandlers['onProductSelected']>((productId) => {}, []);
const onPurchaseStarted = useCallback<EventHandlers['onPurchaseStarted']>((product) => {}, []);
const onPurchaseCompleted = useCallback<EventHandlers['onPurchaseCompleted']>((purchaseResult, product) => {}, []);
const onPurchaseFailed = useCallback<EventHandlers['onPurchaseFailed']>((error, product) => {}, []);
const onRestoreStarted = useCallback<EventHandlers['onRestoreStarted']>(() => {}, []);
const onRestoreCompleted = useCallback<EventHandlers['onRestoreCompleted']>((profile) => {}, []);
const onRestoreFailed = useCallback<EventHandlers['onRestoreFailed']>((error) => {}, []);
const onPaywallShown = useCallback<EventHandlers['onPaywallShown']>(() => {}, []);
const onRenderingFailed = useCallback<EventHandlers['onRenderingFailed']>((error) => {}, []);
const onLoadingProductsFailed = useCallback<EventHandlers['onLoadingProductsFailed']>((error) => {}, []);
const onUrlPress = useCallback<EventHandlers['onUrlPress']>((url) => {
Linking.openURL(url);
}, []);
const onCustomAction = useCallback<EventHandlers['onCustomAction']>((actionId) => {}, []);
const onWebPaymentNavigationFinished = useCallback<EventHandlers['onWebPaymentNavigationFinished']>(() => {}, []);
return (
<AdaptyPaywallView
paywall={paywall}
style={styles.container}
onCloseButtonPress={onCloseButtonPress}
onProductSelected={onProductSelected}
onPurchaseStarted={onPurchaseStarted}
onPurchaseCompleted={onPurchaseCompleted}
onPurchaseFailed={onPurchaseFailed}
onRestoreStarted={onRestoreStarted}
onRestoreCompleted={onRestoreCompleted}
onRestoreFailed={onRestoreFailed}
onPaywallShown={onPaywallShown}
onRenderingFailed={onRenderingFailed}
onLoadingProductsFailed={onLoadingProductsFailed}
onUrlPress={onUrlPress}
onCustomAction={onCustomAction}
onWebPaymentNavigationFinished={onWebPaymentNavigationFinished}
/>
);
}Event examples (Click to expand)
// onCloseButtonPress
{
//Record the event
}
// onAndroidSystemBack
{
//Record the event
}
// onUrlPress
{
"url": "https://example.com/terms"
}
// onCustomAction
{
"actionId": "login"
}
// onProductSelected
{
"productId": "premium_monthly"
}
// onPurchaseStarted
{
"product": {
"vendorProductId": "premium_monthly",
"localizedTitle": "Premium Monthly",
"localizedDescription": "Premium subscription for 1 month",
"price": {
"amount": 9.99,
"currencyCode": "USD",
"currencySymbol": "$",
"localizedString": "$9.99"
}
}
}
// onPurchaseCompleted - Success
{
"purchaseResult": {
"type": "success",
"profile": {
"accessLevels": {
"premium": {
"id": "premium",
"isActive": true,
"expiresAt": "2024-02-15T10:30:00Z"
}
}
}
},
"product": {
"vendorProductId": "premium_monthly",
"localizedTitle": "Premium Monthly",
"localizedDescription": "Premium subscription for 1 month",
"price": {
"amount": 9.99,
"currencyCode": "USD",
"currencySymbol": "$",
"localizedString": "$9.99"
}
}
}
// onPurchaseCompleted - Cancelled
{
"purchaseResult": {
"type": "user_cancelled"
},
"product": {
"vendorProductId": "premium_monthly",
"localizedTitle": "Premium Monthly",
"localizedDescription": "Premium subscription for 1 month",
"price": {
"amount": 9.99,
"currencyCode": "USD",
"currencySymbol": "$",
"localizedString": "$9.99"
}
}
}
// onPurchaseFailed
{
"error": {
"code": "purchase_failed",
"message": "Purchase failed due to insufficient funds",
"details": {
"underlyingError": "Insufficient funds in account"
}
},
"product": {
"vendorProductId": "premium_monthly",
"localizedTitle": "Premium Monthly",
"localizedDescription": "Premium subscription for 1 month",
"price": {
"amount": 9.99,
"currencyCode": "USD",
"currencySymbol": "$",
"localizedString": "$9.99"
}
}
}
// onRestoreCompleted
{
"profile": {
"accessLevels": {
"premium": {
"id": "premium",
"isActive": true,
"expiresAt": "2024-02-15T10:30:00Z"
}
},
"subscriptions": [
{
"vendorProductId": "premium_monthly",
"isActive": true,
"expiresAt": "2024-02-15T10:30:00Z"
}
]
}
}
// onRestoreFailed
{
"error": {
"code": "restore_failed",
"message": "Purchase restoration failed",
"details": {
"underlyingError": "No previous purchases found"
}
}
}
// onRenderingFailed
{
"error": {
"code": "rendering_failed",
"message": "Failed to render paywall interface",
"details": {
"underlyingError": "Invalid paywall configuration"
}
}
}
// onLoadingProductsFailed
{
"error": {
"code": "products_loading_failed",
"message": "Failed to load products from the server",
"details": {
"underlyingError": "Network timeout"
}
}
}
// onPaywallShown
{
//Record the event
}
// onPaywallClosed
{
//Record the event
}
// onWebPaymentNavigationFinished
{
//Record the event
}You can register event handlers you need, and miss those you do not need. In this case, unused event listeners would not be created. There are no required event handlers.
Event handlers return a boolean. If true is returned, the displaying process is considered complete, thus the paywall screen closes and event listeners for this view are removed.
Some event handlers have a default behavior that you can override if needed:
onCloseButtonPress: closes paywall when close button pressed.onUrlPress: opens the tapped URL and keeps the paywall open.onAndroidSystemBack(only for modal presentation): closes paywall when the Back button pressed.onRestoreCompleted: closes paywall after successful restore.onPurchaseCompleted: closes paywall unless user cancelled.onRenderingFailed: closes paywall if its rendering fails.
Event handlers
| Event handler | Description |
|---|---|
| onCustomAction | Invoked when a user performs a custom action, e.g., clicks a custom button. |
| onUrlPress | Invoked when a user clicks a URL in your paywall. |
| onAndroidSystemBack | Modal presentation only: Invoked when a user taps the system Android Back button. |
| onCloseButtonPress | Invoked when the close button is visible and a user taps it. It is recommended to dismiss the paywall screen in this handler. |
| onPurchaseCompleted | Invoked when the purchase completes, whether successful, cancelled by user, or pending approval. In case of a successful purchase, it provides an updated AdaptyProfile. User cancellations and pending payments (e.g., parental approval required) trigger this event, not onPurchaseFailed. |
| onPurchaseStarted | Invoked when a user taps the “Purchase” action button to start the purchase process. |
| onPurchaseFailed | Invoked when a purchase fails due to errors (e.g., payment restrictions, invalid products, network failures, transaction verification failures). Not invoked for user cancellations or pending payments, which trigger onPurchaseCompleted instead. |
| onRestoreStarted | Invoked when a user starts a purchase restoration process. |
| onRestoreCompleted | Invoked when purchase restoration succeeds and provides an updated AdaptyProfile. It is recommended to dismiss the screen if the user has the required accessLevel. Refer to the Subscription status topic to learn how to check it. |
| onRestoreFailed | Invoked when the restore process fails and provides AdaptyError. |
| onProductSelected | Invoked when any product in the paywall view is selected, allowing you to monitor what the user selects before the purchase. |
| onRenderingFailed | Invoked when an error occurs during view rendering and provides AdaptyError. Such errors should not occur, so if you come across one, please let us know. |
| onLoadingProductsFailed | Invoked when product loading fails and provides AdaptyError. If you haven’t set prefetchProducts: true in view creation, AdaptyUI will retrieve the necessary objects from the server by itself. |
| onPaywallShown | Invoked when the paywall is displayed to the user. On iOS, also invoked when a user taps the web paywall button inside a paywall, and a web paywall opens in an in-app browser. |
| onPaywallClosed | Modal presentation only: Invoked when the paywall is closed by the user. On iOS, also invoked when a web paywall opened from a paywall in an in-app browser disappears from the screen. |
| onWebPaymentNavigationFinished | Invoked after attempting to open a web paywall for purchase, whether successful or failed. |