Skip to main content
Question

How to Enable Observer Mode with RevenueCat Programmatically in Unity?

  • January 13, 2025
  • 1 reply
  • 81 views

Forum|alt.badge.img

I’m currently using Unity's IAP package for my in-app purchase system, but I’d like to use RevenueCat in Observer Mode.

In the documentation, I found the following example:

 

// Observer mode can be configured through the Unity Editor. // If you'd like to do it programmatically instead, // make sure to check "Use runtime setup" in the Unity Editor, and then: Purchases.PurchasesConfiguration.Builder builder = Purchases.PurchasesConfiguration.Builder.Init(<api_key>); Purchases.PurchasesConfiguration purchasesConfiguration = builder.SetUserDefaultsSuiteName("user_default") .SetObserverMode(true) .SetAppUserId(appUserId) .Build(); purchases.Configure(purchasesConfiguration);

 

However, the method SetObserverMode(true) doesn't seem to exist, and I get an error saying the method is not found.

Am I missing something? Is this method removed or replaced? And is this all I need to do to enable Observer Mode programmatically, or is there additional configuration required?

Thanks in advance!

This post has been closed for comments

1 reply

Forum|alt.badge.img+8
  • RevenueCat Staff
  • 566 replies
  • January 15, 2025

Hi, thanks for bringing this to our attention, we will update the docs shortly. We have replaced .SetObserverMode() with .SetPurchasesAreCompletedBy()

Depending on which StoreKit version you’re using, you’ll do the following:

.SetPurchasesAreCompletedBy(Purchases.PurchasesAreCompletedBy.MyApp, Purchases.StoreKitVersion.StoreKit2)

or

.SetPurchasesAreCompletedBy(Purchases.PurchasesAreCompletedBy.MyApp, Purchases.StoreKitVersion.StoreKit1)


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