0

i am currently building an app in Flutter using RevenueCat for the in-app-purchases.

I now want to know for each user, if he has already made an in-app-purchase, since I have trial subscriptions activated. I need this information, because I want to adjust the UI in case a user registers with a new account that I haven't seen in RevenueCat so far. In this case, he won't be able to use the trial subscription again, since Google/Apple prevent this.

I am using a custom ID for every user in my app and I use this ID for RevenueCat aswell, one could just create a new account and get a different user id. In this case, this looks like a "new" user to RevenueCat which has no subscriptions. I think the solution would have to check the GooglePlay-Account for an already purchased subscription

So far I have not found a way to find out, if a user has already made an in-app-purchase. Any ideas on how to achieve this?

I have tried to do this with https://pub.dev/packages/in_app_purchase, but no luck so far. All the guides seem to be outdated.

Thanks.

Sebb
  • 121
  • 2
  • 10

2 Answers2

1

based on official documentation

scenario Does not have any login mechanism and only relies on RevenueCat anonymous App User IDs.

solution

Transfer purchases. Required to allow customers to restore transactions after uninstalling / reinstalling your app.

just set that in your revenueCat dashboard and it restores user purchases depending on

google play account or apple id

for more info -> https://www.revenuecat.com/docs/restoring-purchases#example-usage

0

You can check Entitlements to determine if a user has an active subscription, more info here: https://docs.revenuecat.com/docs/customer-info

It will go something like:

try {
  PurchaserInfo purchaserInfo = await Purchases.getPurchaserInfo();
  // access latest purchaserInfo
} on PlatformException catch (e) {
  // Error fetching purchaser info
}

Then

if (purchaserInfo.entitlements.all["my_entitlement_identifier"].isActive) {
  // Grant user "pro" access
}
Calholl
  • 63
  • 5
  • Thank you for your answer. I should have clarified my question a little bit more. Since I am using a custom ID for every user in my app and I use this ID for RevenueCat aswell, one could just create a new account and get a different user id. In this case, this looks like a "new" user to RevenueCat which has no subscriptions. I think the solution would have to check the GooglePlay-Account for an already purchased subscription. – Sebb Jun 18 '22 at 19:35
  • Yes that's a bit more complicated, I know Google has released some improvements to subscriptions, sounds like you're on the right track! – Calholl Jun 18 '22 at 22:55