Skip to main content
Solved

PurchaserInfo in empty

  • 26 July 2021
  • 1 reply
  • 684 views

Forum|alt.badge.img+1

When I try to fetch PurchaserInfo in flutter application. getting below response. Empty details. No able to find clear documentation or video to understand this. Please help.

Details are below

  1. app type - Flutter - iOS version.
  2. Getting this error while running on iOS simulator.
  3. Try to run below code in initS method in a screen.
Future<void> initPlatformState() async {
    Purchases.setDebugLogsEnabled(true);
    await Purchases.setup(<apikey>);

    PurchaserInfo purchaserInfo;
    try {
      await Purchases.getOfferings().then(
        (value) => print(value.all),
      );
      purchaserInfo = await Purchases.getPurchaserInfo();
      print(purchaserInfo.toString());

      if (purchaserInfo.entitlements.all['pro'] != null) {
        appData.isPro = purchaserInfo.entitlements.all['pro'].isActive;
      } else {
        appData.isPro = false;
      }
    } on PlatformException catch (e) {
      print(e);
    }

    print('#### is user pro? ${appData.isPro}');
  }

 

PurchaserInfo{entitlements: EntitlementInfos{all: {}, active: {}},

Best answer by tina

Hi @Hari,

Entitlements may be empty if the app user ID has not made a purchase of a product associated to an entitlement. If entitlements are empty or a specific entitlement is not in the PurchaserInfo object, you can assume the customer has not yet made a purchase for that entitlement. 

It looks like you’re fetching the PurchaserInfo object upon app launch. Have you made a purchase of a product attached to an entitlement with that test account yet? If you have made a purchase and reinstalled the app, you would need to trigger the restore method to re-sync transactions with RevenueCat.

View original
Did this post help you find an answer to your question?

tina
RevenueCat Staff
Forum|alt.badge.img+10
  • RevenueCat Staff
  • July 27, 2021

Hi @Hari,

Entitlements may be empty if the app user ID has not made a purchase of a product associated to an entitlement. If entitlements are empty or a specific entitlement is not in the PurchaserInfo object, you can assume the customer has not yet made a purchase for that entitlement. 

It looks like you’re fetching the PurchaserInfo object upon app launch. Have you made a purchase of a product attached to an entitlement with that test account yet? If you have made a purchase and reinstalled the app, you would need to trigger the restore method to re-sync transactions with RevenueCat.


Reply


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