Skip to main content
Solved

How to refresh user's current offering without restarting app


Forum|alt.badge.img+3

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

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?

View original
Did this post help you find an answer to your question?

3 replies

tina
RevenueCat Staff
Forum|alt.badge.img+10
  • RevenueCat Staff
  • 338 replies
  • Answer
  • July 22, 2022

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?


Forum|alt.badge.img+3
  • Author
  • Member
  • 6 replies
  • July 26, 2022

Yes, thank you!!


Forum|alt.badge.img+6
  • Dedicated Member
  • 15 replies
  • August 23, 2022

Is current offering saved in the RevenueCat database as an attribute of a user? Does it work like so:

  • new user gets assigned the current offering as per the project offerings setup
  • that offering is saved for this user,
  • ‘current’ offering for that user will NOT change, even if current offering in teh project setup is changed. (effects new users going forward).
  • When a transaction occurs, the users current offering is saved with the transaction. 
  • There is no way to tell Revenue Cat database if the client displayed a different offering by a known offering id? Can the client tell the RC backend to change the offering for this user?

 


Reply


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