Build With RevenueCat

Build a customized mobile subscription business with RevenueCat. We do the heavy lifting of normalizing subscribers from any source and maintain a single source of truth for subscription status, so you can get back to building your app.

RevenueCat is a powerful, secure, reliable, and free to use in-app purchase server with global support. All you need to get started is an API key.

Ask A Question



Flutter: purchaserInfo.originalAppUserId initially incorrectly set to an alias: Can I force Purchases.getPurchaserInfo() to refresh?

Hi, I'm using originalAppUserId to uniquely identify users. I'm finding that with a new app installation it initially returns an alias: 1) User has been seen before (i.e. they've used the App with the same Google Play id, whether on the same device or not) 2) User re-installs the app, causing RevenueCat to create a new alias I'm expecting originalAppUserId to return the original id, allocated when they first started using the app, but what actually happens is this: - PurchaserInfo instance from the first call to Purchases.getPurchaserInfo() has originalAppUserId populated with the NEW alias. This persists on subsequent calls, presumably because the instance is cached (as per your documentation). - If I force PurchaserInfo to refresh by putting the app into and out of the background the new PurchaserInfo instance has originalAppUserId correctly set. Calling restoreTransactions seems to force PurchaserInfo to refresh, but this can be a very expensive operation on Flutter, taking multiple seconds where the user has a lot of history. Is there a way I can work around this? Perhaps by marking the PurchaserInfo cache as dirty? I can afford to wait a second or so on first startup since the user is greeted with a welcome screen, but at the moment I can make use of this time because however many times I call Purchases.getPurchaserInfo() it always returns the cached copy with the incorrect id. James

Posted by James Ormrod about a month ago


Mac Catalyst - Purchases.shared.entitlements calls callback with empty entitlements

Hi - I have an iOS app running on a Mac using Catalyst in Mac OS 10.15, Xcode 11.2 beta 2 (11B44). When the app calls `Purchases.shared.entitlements`, on iOS, the one entitlement I have set up in RevenueCat is returned. Building/running the same code on a Mac, the callback is called with `error` == `nil` and `entitlements` == `[]`. Purchases.shared.entitlements { (entitlements, error) in // entitlements is a dictionary with 0 elements // error is nil } Debug output shows no errors and looks like it's making the API calls fine: > 2019-10-21 16:06:40.698573-0500 MyApp[20463:252613] [Purchases] - DEBUG: Debug logging enabled. > 2019-10-21 16:06:40.698633-0500 MyApp[20463:252613] [Purchases] - DEBUG: SDK Version - 2.6.0 > 2019-10-21 16:06:40.698673-0500 MyApp[20463:252613] [Purchases] - DEBUG: Initial App User ID - (null) > 2019-10-21 16:06:40.698926-0500 MyApp[20463:252613] [Purchases] - DEBUG: GET /v1/subscribers/ABCDEBFG-OBFUSCATED-ID-CODE-FGHIJKLM > 2019-10-21 16:06:40.699270-0500 MyApp[20463:252613] [Purchases] - DEBUG: GET /v1/subscribers/ABCDEBFG-OBFUSCATED-ID-CODE-FGHIJKLM/products > 2019-10-21 16:06:40.700428-0500 MyApp[20463:252613] [Purchases] - DEBUG: No cached entitlements, fetching > 2019-10-21 16:06:40.703482-0500 MyApp[20463:252613] [Purchases] - DEBUG: Vending purchaserInfo from cache > 2019-10-21 16:06:40.953341-0500 MyApp[20463:252613] [Purchases] - DEBUG: applicationDidBecomeActive > 2019-10-21 16:06:41.056315-0500 MyApp[20463:253189] [Purchases] - DEBUG: GET /v1/subscribers/ABCDEBFG-OBFUSCATED-ID-CODE-FGHIJKLM 200 > 2019-10-21 16:06:41.121544-0500 MyApp[20463:253169] [Purchases] - DEBUG: GET /v1/subscribers/ABCDEBFG-OBFUSCATED-ID-CODE-FGHIJKLM/products 200 I'm using Purchases SDK v2.6.0 installed via CocoaPods. I'm building/running by just selecting "My Mac" as the build device and clicking the play button icon (that is, running the app). Is there some different way we need to run Mac Catalyst apps? Thanks! Grant

Posted by Grant about a month ago