InAppPurchases restore purchases example

My app has a subscription option and I’m using InAppPurchases to manage subscriptions. I want to give my users the ability to restore their purchases on a different device but I’m new to the app store and wasn’t sure how to do this with InAppPurchases. There doesn’t seem to be a clear method for doing this in the API and there also doesn’t seem to be an example in the docs. Can anyone provide an example of restoring purchases using InAppPurchases? I imagine this is a fairly common use case and it also might make sense to update the docs to include this. Thank you!

Hi, did you manage to figure it out? I’m struggling with the same problem.

I haven’t seen any official docs updates. I did what I thought made sense here and Apple didn’t give me a hard time about it when I submitted the app… I haven’t looked at the code in a few months but as I understood it at the time you would get a list of the products the user purchased previously and call purchaseItemAsync() on them. This should “purchase” the items on a particular device without charging the user a second time, assuming the products are active and not consumable. I’d still love a clearer example in the docs or ideally a built-in API method that handles this for us, considering how common a use case I imagine this is.