Skip to main content
Solved

Flutter - General guidance with PresentPaywall and addCustomerInfoUpdateListener


Forum|alt.badge.img+4

Hello,

Just asking some quick clarification questions publicly in case they help others, these are specific for Flutter but I would assume that they’re applicable for other SDKs.

1. I am invoking:

PaywallResult paywallResult = await RevenueCatUI.presentPaywallIfNeeded("Premium", displayCloseButton: true);

I would assume that the only thing I can do to “react” to whatever the user did would be to switch on the enum - no other subscription details bar PaywallResult (notPresented, cancelled, error, purchased, restored) are returned?

2. Related but I also noticed that you can hook into subscription changes like this:

    Purchases.addCustomerInfoUpdateListener((customerInfo) async {

    });

Would you do this in a centralised place (like where we are initialising the SDK), to listen for all subscription changes for a user and then “observe” these using a ChangeNotifier or similar?

Best answer by sharif

Hi @Mark Walsh,

  1. Yes correct, PaywallResult is the main way to get info out of the paywall. It’s also common to call getCustomerInfo after the paywall result to see the current status of the customer’s subscription after any successful purchases.
  2. There are two ways you can do this. One way is to go the listener route and add a listener to react to changes. You can add the listener in a central place where you can notify various parts of your app of updates or you can add multiple listeners so you don’t have to manage distributing updates throughout your app. The other way to go is to simply call getCustomerInfo any time a user access paid content or takes an action, for example every time the user navigates to a paid part of your app. getCustomerInfo caches data and is designed to be called very frequently in your app.
View original
Did this post help you find an answer to your question?
This post has been closed for comments

2 replies

sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • Answer
  • April 11, 2024

Hi @Mark Walsh,

  1. Yes correct, PaywallResult is the main way to get info out of the paywall. It’s also common to call getCustomerInfo after the paywall result to see the current status of the customer’s subscription after any successful purchases.
  2. There are two ways you can do this. One way is to go the listener route and add a listener to react to changes. You can add the listener in a central place where you can notify various parts of your app of updates or you can add multiple listeners so you don’t have to manage distributing updates throughout your app. The other way to go is to simply call getCustomerInfo any time a user access paid content or takes an action, for example every time the user navigates to a paid part of your app. getCustomerInfo caches data and is designed to be called very frequently in your app.

Forum|alt.badge.img+4
  • Author
  • New Member
  • 2 replies
  • April 12, 2024

Cheers - Great answer!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings