How to refresh user's current offering without restarting app

  • 22 July 2022
  • 2 replies

Userlevel 1
Badge +1

I am wanting to change a user’s current offering depending on how they answer certain questions in our onboarding flow (before seeing the paywall). I am able to successfully update their current offering using the REST API, but when the user reaches the paywall, the “standard” current offering is still shown, not the user’s customer current offering. I read somewhere that the current offering is cached on app launch. Is there any way to refresh this without having to restart the app?


Best answer by tina 23 July 2022, 01:04

View original

2 replies

Userlevel 4
Badge +10

Hey @Jace 

You’re correct that the Offering is fetched upon app launch (or vend from the cache if it’s not stale). We currently do not have a way to invalidate / reset that cache.

However, if you know in the app the Offering identifier the customer is supposed to see after finishing the onboarding flow, you can modify your code logic a bit to not fetch the current Offering.

Here’s an example:

if user.isPaidDownload {
packages = offerings?.offering(identifier: "paid_download_offer")?.availablePackages
} else if user.signedUpOver30DaysAgo {
packages = offerings?.offering(identifier: "long_term_offer")?.availablePackages
} else if user.recentlyChurned {
packages = offerings?.offering(identifier: "ios_subscription_offer")?.availablePackages}

Here’s the Purchases iOS SDK as a reference. Would this work for you instead?

Userlevel 1
Badge +1

Yes, thank you!!