使用in_app或latest_receipt_info获取自动更新的iOS 7类型事务的最新收据?

时间:2023-01-12 21:29:57

I am trying to verifying that an auto-renewable In App purchase has not expired server side (not on a device).

我正在验证应用程序购买中的自动可更新没有过期的服务器端(不是在设备上)。

I am using Apple's Grand Unified Receipt (iOS 7 style transactions). The response returned by Apple contains in_app and latest_receipt_info elements with an array of receipts. The in_app JSON element contains LESS receipts than latest_receipt_info. I was expecting both elements to contain the same number or receipts.

我使用的是苹果的Grand Unified Receipt (iOS 7风格的交易)。苹果返回的响应包含in_app和latest_receipt_info元素以及一系列收据。in_app JSON元素包含的收入少于latest_receipt_info。我希望这两个元素包含相同的数字或收据。

Also, I was expecting that the in_app element would contain ALL the receipts. However, it appears that latest_receipt_info actually contains all the receipts. Apple documentation seems to suggest to use in_app for finding a latest receipt.

另外,我还期望in_app元素包含所有的收据。但是,latest_receipt_info实际上包含了所有的收据。苹果文件似乎建议使用in_app查找最新的收据。

I am surprised to see the latest_receipt_info because Apple's Documentation state that this element is "Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions." (not iOS 7+).

我很惊讶地看到了latest_receipt_info,因为苹果的文档声明,这个元素“仅用于自动更新订阅的ios6风格的事务收据”。(不是iOS 7 +)。

Which JSON element should I iterate to find the latest receipt for auto-renewable iOS 7 style transactions: in_app or latest_receipt_info?

我应该迭代哪个JSON元素来查找自动更新的iOS 7类型事务的最新收据:in_app还是latest_receipt_info?

4 个解决方案

#1


10  

Just wanted to make clear that only the latest_receipt_info field is returning the latest renewed receipt. This is based on what we're actually getting back from Apple.

只是想说明,只有latest_receipt_info字段返回最新的已更新收据。这是基于我们从苹果公司得到的回报。

The relevant documentation is here on page 21.

相关文件在第21页。

Although it states that latest_receipt and latest_receipt_info fields are "Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions", we've found that they are being returned in our iOS 7 receipts. The in_app field within the receipt object is also returned with almost identical data, but doesn't contain the latest receipt info, which is the one you care about in the case of an auto-renewal.

虽然它声明latest_receipt和latest_receipt_info字段“仅用于自动更新订阅的ios6风格的事务收据”,但我们发现它们在ios7收据中被返回。接收对象中的in_app字段也返回了几乎相同的数据,但不包含最新的接收信息,这是在自动更新时需要关注的信息。

#2


3  

This is the most recent and most clear discussion about this. Hope this helps.

这是最近最清楚的讨论。希望这个有帮助。

#3


2  

To verify that an auto-renewable subscription has not expired check the latest_receipt_info element.

要验证自动更新订阅没有过期,请检查latest_receipt_info元素。

This is what's currently (2017-08-09) officially documented on the in_app and latest_receipt_info elements:

这是目前(2017-08-09)in_app和latest_receipt_info元素的正式文档:

in_app

In the JSON file, the value of this key is an array containing all in-app purchase receipts based on the in-app purchase transactions present in the input base-64 receipt-data. For receipts containing auto-renewable subscriptions, check the value of the latest_receipt_info key to get the status of the most recent renewal.

在JSON文件中,这个键的值是一个数组,该数组包含基于输入base-64接收数据中的应用内购买事务的所有应用内购买收据。对于包含自动更新订阅的收据,请检查latest_receipt_info键的值以获得最近更新的状态。

(source)

(源)

latest_receipt_info

Only returned for receipts containing auto-renewable subscriptions. For iOS 6 style transaction receipts, this is the JSON representation of the receipt for the most recent renewal. For iOS 7 style app receipts, the value of this key is an array containing all in-app purchase transactions. This excludes transactions for a consumable product that have been marked as finished by your app.

只返回包含自动更新订阅的收据。对于ios6样式的事务收据,这是最近更新的收据的JSON表示。对于iOS 7风格的应用程序收据,这个键的值是一个包含所有应用程序内购买事务的数组。这将排除应用程序标记为已完成的可消费产品的事务。

(source)

(源)

#4


0  

Receipt Fields(Apple Docs)

收据字段(苹果文档)

The documentation above makes it pretty clear to use in_app. Please note the line "Keys not documented below are reserved for use by Apple and must be ignored by your app" in the documentation. So even though the decoded receipt has latest_receipt_info, we should ignore that.

上面的文档清楚地说明了如何使用in_app。请注意,在文档中“以下未记录的按键是为苹果保留的,必须被你的应用程序忽略”。因此,即使解码的收据有latest_receipt_info,我们也应该忽略它。

But I agree, the documentation is very lacking and that makes me nervous. Let me know how was your experience using iOS 7 style receipt verification in production.

但我同意,文件非常缺乏,这让我很紧张。让我知道你的经验是如何使用iOS 7风格的收据验证在生产中。

#1


10  

Just wanted to make clear that only the latest_receipt_info field is returning the latest renewed receipt. This is based on what we're actually getting back from Apple.

只是想说明,只有latest_receipt_info字段返回最新的已更新收据。这是基于我们从苹果公司得到的回报。

The relevant documentation is here on page 21.

相关文件在第21页。

Although it states that latest_receipt and latest_receipt_info fields are "Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions", we've found that they are being returned in our iOS 7 receipts. The in_app field within the receipt object is also returned with almost identical data, but doesn't contain the latest receipt info, which is the one you care about in the case of an auto-renewal.

虽然它声明latest_receipt和latest_receipt_info字段“仅用于自动更新订阅的ios6风格的事务收据”,但我们发现它们在ios7收据中被返回。接收对象中的in_app字段也返回了几乎相同的数据,但不包含最新的接收信息,这是在自动更新时需要关注的信息。

#2


3  

This is the most recent and most clear discussion about this. Hope this helps.

这是最近最清楚的讨论。希望这个有帮助。

#3


2  

To verify that an auto-renewable subscription has not expired check the latest_receipt_info element.

要验证自动更新订阅没有过期,请检查latest_receipt_info元素。

This is what's currently (2017-08-09) officially documented on the in_app and latest_receipt_info elements:

这是目前(2017-08-09)in_app和latest_receipt_info元素的正式文档:

in_app

In the JSON file, the value of this key is an array containing all in-app purchase receipts based on the in-app purchase transactions present in the input base-64 receipt-data. For receipts containing auto-renewable subscriptions, check the value of the latest_receipt_info key to get the status of the most recent renewal.

在JSON文件中,这个键的值是一个数组,该数组包含基于输入base-64接收数据中的应用内购买事务的所有应用内购买收据。对于包含自动更新订阅的收据,请检查latest_receipt_info键的值以获得最近更新的状态。

(source)

(源)

latest_receipt_info

Only returned for receipts containing auto-renewable subscriptions. For iOS 6 style transaction receipts, this is the JSON representation of the receipt for the most recent renewal. For iOS 7 style app receipts, the value of this key is an array containing all in-app purchase transactions. This excludes transactions for a consumable product that have been marked as finished by your app.

只返回包含自动更新订阅的收据。对于ios6样式的事务收据,这是最近更新的收据的JSON表示。对于iOS 7风格的应用程序收据,这个键的值是一个包含所有应用程序内购买事务的数组。这将排除应用程序标记为已完成的可消费产品的事务。

(source)

(源)

#4


0  

Receipt Fields(Apple Docs)

收据字段(苹果文档)

The documentation above makes it pretty clear to use in_app. Please note the line "Keys not documented below are reserved for use by Apple and must be ignored by your app" in the documentation. So even though the decoded receipt has latest_receipt_info, we should ignore that.

上面的文档清楚地说明了如何使用in_app。请注意,在文档中“以下未记录的按键是为苹果保留的,必须被你的应用程序忽略”。因此,即使解码的收据有latest_receipt_info,我们也应该忽略它。

But I agree, the documentation is very lacking and that makes me nervous. Let me know how was your experience using iOS 7 style receipt verification in production.

但我同意,文件非常缺乏,这让我很紧张。让我知道你的经验是如何使用iOS 7风格的收据验证在生产中。