iOS - 恢复自动续订订阅 [英] iOS - Restoring auto renewable subscription

查看:912
本文介绍了iOS - 恢复自动续订订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施自动续订订阅。我已经得到以下问题

I am implementing auto renewable subscription.In that i have got the below question

用户是否能够在订阅内容过期后恢复订阅内容?

Can a user be able to restore the subscription content even after it is expired?

如果是这样,我如何验证它们并让它们下载

if so how can i validate them and let them to download

推荐答案

查看恢复自动续订订阅

基本上你需要拨打 [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] ,您将恢复已恢复的交易。您应该查看 originalTransaction 属性。您将知道每笔交易的交易日期(也适用于已过期的交易日期)。然后,您查看产品标识符,您的应用程序应该知道每个产品标识符的订阅长度是多少。由于您知道每笔交易的开始日期和长度,因此您可以计算订阅有效的时间段。
您将它们验证为任何其他交易 - 将它们发送到您的服务器,然后发送到 http://buy.itunes.apple.com/verifyReceipt (更改购买沙箱进行测试)。

Basically you need to call [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] and you'll get back restored transactions. You should look at originalTransaction property. You'll know transaction date for each transaction(also for expired ones). Then you look at product identifier and your app should know what's the lenght of subscription for each product identifier. And since you know start date and lenght of each transaction you can calculate time periods during which subscription was valid. You validate them as any other transaction - send them to your server which will send then to http://buy.itunes.apple.com/verifyReceipt (change buy to sandbox for testing).

这篇关于iOS - 恢复自动续订订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆