除了 expires_date_ms 之外,我还应该检查 cancellation_date_ms 以获得自动续订订阅吗?

Should I check cancellation_date_ms in addition to expires_date_ms for a auto-renewable subscriptions?

我正在我的应用程序中实施自动续订订阅。

目前,为了检查用户是否有有效订阅,我检查了从 Apple 的 /verifyReceipt 服务返回的响应 JSON 中 latest_receipt_info 数组中的所有记录,找到一个最大 expires_date_ms 并检查这个日期是否在未来。在检查日期之前,我还检查 status 字段是否为 0(收据有效)。

本来以为够用了,最近才发现还有一个字段- cancellation_date_ms。据我从文档中了解到,如果用户已通过 Apple 支持取消订阅,则此文件会存在。

来自(Apple docs

You can use this value to:

Determine whether to stop providing the content associated with the purchase.

Check for any latest renewal transactions, which may indicate the user re-started or upgraded their subscription, for an auto-renewable subscription purchase.

所以我想知道,如果用户通过Apple支持取消订阅,这会影响当前订阅期的expires_date_ms吗?所以下次我检查 expires_date_ms 时,我知道订阅未激活。

或者 expires_date_ms 是否与用户取消订阅之前保持不变,所以我也需要检查 cancellation_date_ms

您还应该检查 cancellation_date_msExpires_date 当客户通过 Apple 支持取消订阅时,字段不会更改。

这是生产 JSON 退款示例:

"latest_receipt_info": [
    {
        "quantity": "1",
        "product_id": "XXX",
        "transaction_id": "150000567873035",
        "original_transaction_id": "150000567873035",
        "purchase_date": "2019-11-10 17:37:05 Etc/GMT",
        "purchase_date_ms": "1573407425000",
        "purchase_date_pst": "2019-11-10 09:37:05 America/Los_Angeles",
        "original_purchase_date": "2019-11-10 17:37:06 Etc/GMT",
        "original_purchase_date_ms": "1573407426000",
        "original_purchase_date_pst": "2019-11-10 09:37:06 America/Los_Angeles",
        "expires_date": "2019-12-10 17:37:05 Etc/GMT",
        "expires_date_ms": "1575999425000",
        "expires_date_pst": "2019-12-10 09:37:05 America/Los_Angeles",
        "cancellation_date": "2019-12-05 19:14:48 Etc/GMT",
        "cancellation_date_ms": "1575573288000",
        "cancellation_date_pst": "2019-12-05 11:14:48 America/Los_Angeles",
        "web_order_line_item_id": "150000194283402",
        "is_trial_period": "false",
        "is_in_intro_offer_period": "false",
        "cancellation_reason": "0",
        "subscription_group_identifier": "20502261"
    }
],
"pending_renewal_info": [
    {
        "auto_renew_product_id": "XXX",
        "original_transaction_id": "150000567873035",
        "product_id": "XXX",
        "auto_renew_status": "0"
    }
]}