Craig-Ronald / capacitor-subscriptions

MIT License
14 stars 5 forks source link

"Restore purchase" option #17

Closed jeroenman closed 3 months ago

jeroenman commented 3 months ago

Hi, Thanks for publishing this repo, it seems just what I need. However, I couldn't find a method like "Restore purchase". Do you use a different plugin for this? Or am I missing something. As far as I understand it's required to have it in your app.

CraigRonald555 commented 3 months ago

Hi @jeroenman,

You can just implement a button which calls getCurrentEntitlements() in order to restore purchases. Please see the documents from Apple confirming this:

In regular operations, there’s no need to call sync(). StoreKit automatically keeps up to date transaction information and subscription status available to your app. When users reinstall your app or download it on a new device, the app automatically has all transactions available to it upon initial launch. There’s no need for users to ask your app to restore transactions — your app can immediately get the current entitlements using currentEntitlements

https://developer.apple.com/documentation/storekit/appstore/3791906-sync/

jeroenman commented 3 months ago

Ah got it, thank you!

jeroenman commented 3 months ago

Update on this one: a "Restore purchase" button is not need for a subscription. Just passed the Apple review after removing it.