Solved

PurchaserInfo in empty

  • 26 July 2021
  • 1 reply
  • 76 views

Badge

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: {}},

icon

Best answer by tina 27 July 2021, 21:09

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

1 reply

Userlevel 2
Badge +7

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