开发者

How to determine if a user has already purchased subscription

I'm implementing renewable subscriptions. I successfully used a test account to get a subscription, but afterwards every开发者_如何学Go time I got transacitonState: SKPaymentTransactionStateFailed.

How can I determine if the user has already purchased the subscription? (For example in the case the user deletes app and reinstall it, how can I know the user has purchased the service already?)

Thanks in advance. I really appreciate your help !


If the user deletes the app or gets a new device, you should provide them with a button to restore their purchases, using -[SKPaymentQueue restoreCompletedTransactions]. Then you will get information about the user's past subscriptions.


Actually, you can't determine if the user is already subscribed, you should have Subscribe button that new users can use to subscribe, and Restore button for already subscribed users.

But what if a subscribed user tries to subscribe again?

The request will fail as you said in the question, and you'll not know if that's because the user is already subscribed or it's another error.

The better solution for this is to show an alert view that suggests to use Restore button in case the user is already subscribed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜