is_trial_period 留在 Apple 的收据沙盒中 "on"

is_trial_period stays "on" in Apple's Receipt Sandbox

我在调试 Apple 的应用内购买收据时遇到问题。尽管购买已经过期,但字段 "is_trial_period" 似乎保持 true。 据我了解,Apple 为调试订阅定义了短期,如下所示:

Testing In-App Purchase Products

这些时间是否也适用于试用期?

这是因为 Apple 针对试用期发出了单独的交易。

以下是 Apple 收据的示例摘录:

"latest_receipt_info": [
    {
        "quantity": "1",
        "product_id": "onemonth_freetrial",
        "transaction_id": "1000000328795138",
        "original_transaction_id": "1000000328795138",
        "purchase_date": "2017-08-29 23:13:52 Etc/GMT",
        "purchase_date_ms": "1504048432000",
        "purchase_date_pst": "2017-08-29 16:13:52 America/Los_Angeles",
        "original_purchase_date": "2017-08-29 23:13:53 Etc/GMT",
        "original_purchase_date_ms": "1504048433000",
        "original_purchase_date_pst": "2017-08-29 16:13:53 America/Los_Angeles",
        "expires_date": "2017-08-29 23:16:52 Etc/GMT",
        "expires_date_ms": "1504048612000",
        "expires_date_pst": "2017-08-29 16:16:52 America/Los_Angeles",
        "web_order_line_item_id": "1000000036088032",
        "is_trial_period": "true"
    },
    {
        "quantity": "1",
        "product_id": "onemonth_freetrial",
        "transaction_id": "1000000328796241",
        "original_transaction_id": "1000000328795138",
        "purchase_date": "2017-08-29 23:16:52 Etc/GMT",
        "purchase_date_ms": "1504048612000",
        "purchase_date_pst": "2017-08-29 16:16:52 America/Los_Angeles",
        "original_purchase_date": "2017-08-29 23:13:53 Etc/GMT",
        "original_purchase_date_ms": "1504048433000",
        "original_purchase_date_pst": "2017-08-29 16:13:53 America/Los_Angeles",
        "expires_date": "2017-08-29 23:21:52 Etc/GMT",
        "expires_date_ms": "1504048912000",
        "expires_date_pst": "2017-08-29 16:21:52 America/Los_Angeles",
        "web_order_line_item_id": "1000000036088033",
        "is_trial_period": "false"
    }
]

latest_receipt_info 字段将包含每个 'renewal' 或 'transaction' 的数组。 Apple 处理免费试用的方式是发出一笔交易,该交易始终 is_trial_period 为真,随后的非试用续订 is_trial_period 为假。当您处理收据时,请确保您正在查看 purchase_dateexpiration_date 的最新交易,这应该代表最新的续订以及您应该根据其解锁内容的交易。

关于沙盒中的长度,如果您的 IAP 产品有免费试用,沙盒环境将发布一个试用期和 5 个续订,总共六个续订。