Skip to main content
Question

Cross-platform UpdatedPurchaserInfoListener

  • 18 February 2022
  • 2 replies
  • 64 views

Hi,

I would like to ask if the UpdatedPurchaserInfoListener works across platforms. eg. user will be logged in on iOS and the Android app and will buy a product on one of them. Does this listener also trigger the other platform's UpdatedPurchaserInfoListener? (when the other app is active)

2 replies

Userlevel 5
Badge +8

UpdatedPurchaserInfoListener will work across platforms from the same store, meaning that if you have an iOS app, a macOS app, a tvOS app and a watchOS app, for example, UpdatedPurchaserInfoListener will get triggered when there’s a purchase on any of them. 

The same applies if you have multiple Android devices, for example. 

However, crossing the boundary between Android and iOS, our SDK doesn’t have the ability to push information into the new devices, so the listener won’t automatically be called on an Android app when you make a purchase on iOS. 

 

You can achieve this behavior, though, by sending a background push notification to devices of users who made a purchase, and then force-refreshing cache. 

So, for example, if Alice buys a subscription on an iOS device, you can use webhooks to get notified on your server, and then push a background notification on Alice’s Android device that tells it that there’s new purchaserInfo available. 

 

At that point, on the Android device, you’d call invalidatePurchaserInfoCache() and then getPurchaserInfo(). This would trigger a force-refresh on the Android device and get you the latest information, and it would also trigger the UpdatedPurchaserInfoListener on the Android device. 

 

Hope this helps!

 

Userlevel 1
Badge +1

Thank you for your detailed reply. We'll use the described procedure. But instead of notification we'll use Firestore to share the information across all systems.

Reply