Skip to main content

Hello,

I have a question about restoring purchases. I have an app using anonymous user ids. App starts with an intro slider, the last slider page is a pre-paywall view where the user can choose to either restore purchase or goto subscriptions ( hence the paywall). Restore purchase works as intended if the user has an ongoing subscription.  I also saw that if a user with an ongoing subscription by misstake continued to the paywall view and tried to buy another subscription this was detected by the call to Purchases.shared.purchase… and a relevant alert in Swedish was presented, perfect!

But my question is there a way to programatically check if a user is eligible to restore a purchase when the user has made a new installation of the app? Then I could disable the goto subscription button on the pre-paywall view.

 

Best Regards, Tomas

Hi there, I was looking for something similar to OP’s question and saw this thread. It’s my understanding that in StoreKit 2 you don’t actually need a manual restore purchases function because it’s automatically checked during launch or something like that.

 

I get comments from users every week asking about restoring their purchases after a reinstall; it’s clearly detailed in the app but you know🤷🏻‍♂️

 

It would be great to have an automatic restore functionality to avoid those problems. Any work in progress/expected potential release @kaitlin ?

 

Thanks!


Hi Kaitlin,

Thank you for your answer.  It seems rather complicated, so I think I continue to use manual restore functionality. 
 

Regards Tomas

 


Hey @Tomas M ,

In order to programmatically check if a user is eligible to restore a purchase, you’d have to inspect their receipt, which can get complicated. We’re actually working on a library that can load and parse the iOS receipt (keep an eye on our repo: https://github.com/RevenueCat/purchases-ios), then what would do is see if the receipt has purchases and if yes, compare with purchases from getCustomerInfo and restore purchases if they differ. But, this is quite a lot of work and still pretty error prone - for example, if the receipt isn’t up to date, getCustomerInfo is cached, etc. 

 

All this to say, it’s best just to allow the user to restore purchases manually and if you’re allowing that, it’s probably not worth it to go through all of that work. But - if you think it will improve your user experience, it’s definitely possible!


Reply