本文介绍了如何检测和验证更新为自动再生订阅?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我已经安装了我的为期1个月,这相当于在沙箱中5分钟左右的应用程序自动再生订阅。在客户端应用程序我同意,发送回执到我的服务器,它得到验证,我把记录​​在我的数据库,这个用户有一个订阅。

我的问题是我该如何检查,如果该订阅已续订?我已阅读文档和想不出该怎么办。

这里是我迄今为止:


  1. 是被发送到我的服务器初始收据验证了状态0,太棒了。我也得到latest_receipt,我在用最古老的收据替换数据库中。

  2. 6分钟后,当我尝试验证latest_receipt,我得到状态21006(过期收据)和这样的:

  {收据:
       {original_purchase_date_pst:2013年8月6日11时58分04秒美洲/洛杉矶,
         唯一标识符: ' - - - - - - ',
         original_t​​ransaction_id:----------,
         expires_date:1376129825000,
         TRANSACTION_ID:------------,
         量:'1',
         PRODUCT_ID:'认购',
         ITEM_ID:--------,
         出价:COM --------,
         unique_vendor_identifier:---------,
         web_order_line_item_id:---------,
         bvrs:'2.0',
         expires_date_formatted:2013年8月10日10时17分05秒ETC / GMT,
         购买日期:2013年8月10日10时12分05秒ETC / GMT,
         purchase_date_ms:1376129525000,
         expires_date_formatted_pst:2013年8月10日3时17分05秒美洲/洛杉矶,
         purchase_date_pst:2013年8月10日3时12分05秒美洲/洛杉矶,
         original_purchase_date:2013年8月6日18时58分04秒ETC / GMT,
         original_purchase_date_ms:1375815484000},
      latest_expired_receipt_info:
       {original_purchase_date_pst:2013年8月6日11时58分04秒美洲/洛杉矶,
         唯一标识符: ' - - - -',
         original_t​​ransaction_id:' - ',
         expires_date:1376129825000,
         TRANSACTION_ID:' - ',
         量:'1',
         PRODUCT_ID:'认购',
         ITEM_ID:' - ',
         出价:com.-',
         unique_vendor_identifier:' - ',
         web_order_line_item_id:' - ',
         bvrs:'2.0',
         expires_date_formatted:2013年8月10日10时17分05秒ETC / GMT,
         购买日期:2013年8月10日10时12分05秒ETC / GMT,
         purchase_date_ms:1376129525000,
         expires_date_formatted_pst:2013年8月10日3时17分05秒美洲/洛杉矶,
         purchase_date_pst:2013年8月10日3时12分05秒美洲/洛杉矶,
         original_purchase_date:2013年8月6日18时58分04秒ETC / GMT,
         original_purchase_date_ms:1375815484000},
      状态:21006}

使用数组中的第二个元素是latest_receipt_info,但现在它的latest_EXPIRED_receipt_info。这里是文档说什么:

So if the sub has been renewed since my server last checked, the decoded receipt for the renewal should be in latest_expired_receipt_info. In that object the expires_date is the same as the original receipt's expires_date.

What the hell? I just want to check if the sub is active. Can anyone explain in simple words how do I do that?

Thank you!

解决方案

My experience. Let's assume, we always send initial receipt to Apple's server.

In any case, you'll get JSON with at least two fields: status (no comments) and receipt (information about receipt that you've send).

Additionally to that:

1) If the subscription is still active, you'll additionally get latest_receipt (base64-encoded string) and latest_receipt_info (information about that receipt).

2) If the subscription is already expired, you'll additionally get latest_expired_receipt_info (information about last renewing receipt). Yes, you get only information about it, no base64-encoded string.

And yes, AFAIK, that's not documented anywhere. Hope that helps.

这篇关于如何检测和验证更新为自动再生订阅?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 09:46
查看更多