Skip to main content
Question

Handling errors when using a paywall in React Native

  • November 27, 2024
  • 1 reply
  • 38 views

Forum|alt.badge.img

When using `presentPaywall` with React Native there seems to be no way to pass in error handlers or any other listeners. Is there a way around it?

This post has been closed for comments

1 reply

jeffrey_bunn
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • December 4, 2024

Hi ​@radko93! You can await the result returned from `presentPaywall`, which will give you a PaywallResult. There, you can check various paywall results (docs). If you want to pass in handlers, you can use RevenueCatUI.Paywall:

<RevenueCatUI.Paywall
options={{
offering: offering // Optional Offering object obtained through getOfferings
}}
onRestoreCompleted={({customerInfo}: { customerInfo: CustomerInfo }) => {
// Optional listener. Called when a restore has been completed.
// This may be called even if no entitlements have been granted.
}
onDismiss={() => {
// Dismiss the paywall, i.e. remove the view, navigate to another screen, etc.
// Will be called when the close button is pressed (if enabled) or when a purchase succeeds.
}}