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?
Solved
How to refresh user's current offering without restarting app
Best answer by tina
Hey
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?
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.