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

refresh receipt and validate afterwards #42

Closed
bb-git opened this issue May 30, 2016 · 2 comments
Closed

refresh receipt and validate afterwards #42

bb-git opened this issue May 30, 2016 · 2 comments
Labels
answered Questions which have accepted answers. area: receipt-validation validating receipts for customer or purchase verification difficulty: intermediate this issue is tough, contributions welcome type: question

Comments

@bb-git
Copy link

bb-git commented May 30, 2016

So if I understand right, I can refresh the receipt if there is no receipt present, while verifying the receipt with: SwiftyStoreKit.refreshReceipt

But after doing this, would't it be right to verify the refreshed receipt again calling
SwiftyStoreKit.verifyReceipt ?

But in the completion handler I cannot access the product the receipts belongs to. I have nonconsumable products and autorenewing subscriptions, so I'm not able to choose the right verification method.

In your example you just refresh the receipt without doing anything with it, what's the purpose of this?

Thanks

@bizz84
Copy link
Owner

bizz84 commented Jul 10, 2016

Apologies for the very late reply.

I have reviewed the code as I didn't implement this entirely myself. From what I can understand:

  • you can call verifyReceipt() to retrieve the receipt as a dictionary. If this is successful you can test each non consumable product and autorenewing subscription individually against the receipt with the SwiftyStoreKit.verifyPurchase() and SwiftyStoreKit.verifySubscription() methods.
  • If no receipt is found, you can try to call refreshReceipt(), however note that this is implemented differently for iOS/tvOS and OS X.
  • If refreshReceipt() succeeds, maybe it makes sense to call verifyReceipt() again as you mentioned.

Ideally I would like this API to be a bit better so that you don't have to make three calls.

@bizz84 bizz84 added the answered Questions which have accepted answers. label Oct 19, 2016
@bizz84 bizz84 added the area: receipt-validation validating receipts for customer or purchase verification label Nov 5, 2016
@bizz84 bizz84 added the difficulty: intermediate this issue is tough, contributions welcome label May 18, 2017
@bizz84
Copy link
Owner

bizz84 commented May 18, 2017

This has now been fixed on release 0.10.0

@bizz84 bizz84 closed this as completed May 18, 2017
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. area: receipt-validation validating receipts for customer or purchase verification difficulty: intermediate this issue is tough, contributions welcome type: question
Projects
None yet
Development

No branches or pull requests

2 participants