【发布时间】:2015-02-13 06:30:47
【问题描述】:
更新:
我在这里发布@vitro 的评论:
2021 年 - 它就在那里:https://developer.apple.com/documentation/appstorereceipts/expires_date_ms 此字段在 JSON 响应中返回,在 responseBody.Latest_receipt_info 和 responseBody.Receipt.In_app 数组中。
订阅到期或续订的时间,采用 UNIX 纪元时间格式,以毫秒为单位。使用此时间格式处理日期。
谢谢@vitro
原帖:
在验证可续订的订阅收据时,我正在尝试获取最新收据的到期日期。
根据有关收据字段的苹果文档,“expires_date”字段应包含一个数字,即自 1970 年 1 月 1 日 00:00:00 GMT 以来的毫秒数。(https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1)
当我获取该字段时,我从“expires_date”字段接收到一个带有格式化日期的字符串。还有一个名为“expires_date_ms”的字段似乎提供了正确的数据。 Apple 声明“以下未记录的密钥仅供 Apple 使用,您的应用必须忽略。”
这是我的收据示例:
{"quantity":"1",
"product_id":"com.testapp.test",
"transaction_id":"1000000135676121",
"original_transaction_id":"1000000135134855",
"purchase_date":"2014-12-15 06:53:54 Etc/GMT",
"purchase_date_ms":"1418626434059",
"purchase_date_pst":"2014-12-14 22:53:54 America/Los_Angeles",
"original_purchase_date":"2014-12-15 06:51:12 Etc/GMT",
"original_purchase_date_ms":"1418626272000",
"original_purchase_date_pst":"2014-12-14 22:51:12 America/Los_Angeles",
"expires_date":"2014-12-15 06:56:10 Etc/GMT",
"expires_date_ms":"1418626570000",
"expires_date_pst":"2014-12-14 22:56:10 America/Los_Angeles",
"web_order_line_item_id":"1000000028947356",
"is_trial_period":"false"
}]
我应该使用哪个字段来获取具有最佳实践的过期日期?
【问题讨论】:
-
我刚刚向 Apple 提交了一份关于此问题的错误报告。你最终在生产中使用了什么?
标签: in-app-purchase subscription auto-renewing