Hi,
We’ve updated our docs here on the recommended way to handle this, which is to call syncPurchases
programmatically similar to what was mentioned in support.
When users click your link within your app to redeem the offer code, it will take them outside of the app to complete the purchase. It is important to call syncPurchases when the user returns back to your app to retrieve their purchase. This may be done by recording when the user leaves the app due to the link, and calling syncPurchases
when the user returns to the app. If not, the user may need to trigger a restore within your app when they come back.
I didn’t see in the post you shared mentioned where it was mentioned not to call syncPurchases
programmatically. However, we do mention that about restorePurchases
,
The restorePurchases
method should not be triggered programmatically, since it may cause OS level sign-in prompts to appear, and should only be called from some user interaction (e.g. tapping a "Restore" button.)
We also mention about syncPurchases
that it is the way to programatically trigger a restore,
syncPurchases is a method we provide in our SDK which allows you to programmatically trigger a restore. This method, much like restorePurchases, reactivates any content that had previously been purchased from the same store account (Apple, Google, or Amazon).
(was a little lengthy here for those that may come later on)
Thank you for pointing this out! This note was meant to discourage users from calling syncPurchases
on every app launch for every app user when doing a migration. Calling it in the cases that a user leaves the app via offer code link and returns is perfectly fine, and the only alternative to having the user hit restore manually if the app does not pick it up.
Hello, this issue happened the same way here, with the difference that I was already calling sync purchases when the user returns to app due to the link, but that doesn’t seem to work… Is there a time to wait before calling sync purchases, so the method call actually returned nothing?
If that’s the case, i should wait a few seconds before calling syncPurchases?
Or retry a couple times?
Thanks for the answer