Solved

What's the best way to handle the delays on subscription changes?

  • 24 January 2022
  • 4 replies
  • 113 views

Badge

The use case is simple. Let’s take my React Native iOS app as an example:

  1. A user who has already purchased a “Premium” subscription in my app goes to their iPhone Settings and unsubscribes
  2. Now they open my app and goes to the “Subscription” page to check the status
  3. My subscription page says that their sub is active AND will renew at date X, even if I run the getPurchaseInfo() again
  4. My user gets confused/angry and contacts my support

How can I avoid the above? I’m new to RC and have just been playing around in the Sandbox environment. RC docs says certain attributes, like the “willRenew” could take multiple hours to sync. I have activated Platform Server Notifications but at least in Sandbox it seems like the info I get back from getPurchaseInfo()

How can I avoid these delays and caches and whatnot, and always be sure that everything is updating instantly and the data is accurate and “fresh”?

I asked the RC support about this, and they just copy/pasted the first two paragraphs of the “Webhooks” section in their reply to me. Will webhooks trigger at a faster rate than the sync between App Stores and RC? Or I’m not just understanding how webhooks would solve the use case above?

 

How do you manage to always show accurate statuses in your app?

icon

Best answer by tina 24 January 2022, 23:21

View original

4 replies

Userlevel 4
Badge +10

Hey @fishlurk 

To avoid delays you are correct that setting up Platform Server Notifications will reduce the duration of delays. The reason that delays happen in the first place is due to our polling. RevenueCat will poll the respective app stores every couple of hours to fresh the receipt from your customers. With Platform Server Notifications enabled, the app stores will ping RevenueCat server’s directly when there’s been a change in a customer’s receipt and we will refresh the receipt manually on our end. Any new information from the receipt will also be reflected in the PurchaserInfo object.

 

Our webhooks will trigger whenever our servers detect an event. In other words, webhooks trigger at the same rate RC syncs with Apple. 

 

How do you manage to always show accurate statuses in your app?

We typically recommend to developers to also listen for PurchaserInfo updates. Whenever the PurchaserInfo object changes, you can react to the delegate to update any statuses in the app. Docs for reference: https://docs.revenuecat.com/docs/getting-started#optional-listening-for-purchaser-info-updates 

Hey @tina thanks for the great answer.

Is there any estimation of the delay that can occur between RC and the app stores? e.g. what’s the worst case scenario/average time from the time a user cancels his/hers subscription until RC (and we) pick up on that? 

Userlevel 4
Badge +10

Hey @Shahak Shalev 

There are 3 ways RevenueCat can pick up on subscription changes:

  • Customer opens the app and notifies RC through the SDK 
  • RevenueCat polls the app stores every couple of hours
  • App stores ping RC directly through Platform Server Notifications

From these 3 scenerios, the worst case is waiting for RC to poll the app store to refresh the receipts. If you set up Platform Server Notifications, the update will be near real-time. 

Hi Tina, thanks for the answer

 

I activated Platform Server Notfications for both platforms (they do recieve data) but in Sandbox it takes a long time to get subscription changes made in the appstore directly…. Is this because I’m on the sandbox?


Thanks!

Reply