Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle restore process for Auto-Renewable Subscription #253

Closed
2 tasks
thihaaung6245 opened this issue Aug 3, 2017 · 8 comments
Closed
2 tasks
Labels
answered Questions which have accepted answers. type: question

Comments

@thihaaung6245
Copy link

Platform

  • iOS

In app purchase type

  • Auto-Renewable Subscription

Environment

  • Sandbox
  • Production

Version

ℹ Latest Version

Any Help, I still can't figure it out how to handle restore process for this? After verify, it got the receipt that it was .purchased or .expired right? then how can we finishTransaction without calling purchaseProduct?

@bizz84
Copy link
Owner

bizz84 commented Aug 3, 2017

There is no concept of restoring a subscription. The only time you would call finishTransaction is when you purchase it (or when you complete transactions).

Afterwards, if you want to check if the subscription is still valid or not, you can just verify the subscription as outlined here:

https://github.com/bizz84/SwiftyStoreKit#verify-subscription

@bizz84 bizz84 added type: question answered Questions which have accepted answers. labels Aug 3, 2017
@thihaaung6245
Copy link
Author

thihaaung6245 commented Aug 4, 2017

I am afraid that Apple will reject my app for missing restore button since mine was subscription based app. Everything is working at server-side for content delivering. So, for the restore state, I will do verifyReceipt and verifySubscription every time the user come into the application. was it ok? even not adding the restore button? and do verifyReceipt get the receipt if the receipt is not found on the device. Especially use subscribed on one device but, move to another device?

@iwasrobbed
Copy link

iwasrobbed commented Aug 5, 2017

@htarwara6245 I believe you're correct. There's a bit of clarifying information here as well: #207

You can hook the restore button up to the verifyReceipt (which refreshes the receipt) -> verifySubscription method and check that they have subscribed to one of your subscription options.

I agree this could be clarified in the README a bit since there's not a clear enough distinction between subscriptions and one-time purchases for restoring (and my app has both).

@iwasrobbed
Copy link

iwasrobbed commented Aug 5, 2017

Seems there's more information here as well: #194

It appears you need to enumerate over your product identifiers and call verifySubscription on each. The restorePurchases method will be "successful" even if a subscription is expired, which seems like a (documentation) bug to me.

Could you clarify this @bizz84? The rest of the API is very clear (great work overall)

@iwasrobbed
Copy link

I've included some sample code here for how I'm doing this: #194 (comment)

@thihaaung6245
Copy link
Author

@iwasrobbed thanks for your help, I will take a look into. Also in a mean while, looking for any good suggestions.

@bizz84
Copy link
Owner

bizz84 commented Aug 12, 2017

@iwasrobbed That's correct, calling restorePurchases will return all non-consumable products and subscriptions that were previously purchased, regardless of whether they are expired or not.

To check subscription validity, use verifyReceipt and verifySubscription.

I will update the README accordingly.

@iwasrobbed
Copy link

@htarwara6245 Mind leaving this issue open until the readme is updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Questions which have accepted answers. type: question
Projects
None yet
Development

No branches or pull requests

3 participants