gpt4 book ai didi

iOS IAP 订阅/App Store 服务器到服务器通知。将 verifyReceipt API 替换为 unified_receipt

转载 作者:行者123 更新时间:2023-12-05 06:59:36 36 4
gpt4 key购买 nike

我正在升级已使用 App Store Server Notifications 的现有 iOS IAP 订阅系统。我现有的解决方案使用现已弃用的 latest_receiptlatest_receipt_infolatest_expired_receiptlatest_expired_receipt_info 字段。根据 Apple 的说法,这些字段现在全部替换为单个 unified_receipt。字段。

在观看了所有必需的 WWDC 视频并筛选了可用的少量文档之后,我仍然有一些悬而未决的问题。

latest_receipt_info 字段记录为:

An array that contains the latest 100 in-app purchase transactions of the decoded value in latest_receipt.

这意味着该数组将包含客户的整个交易历史记录。这不仅包括相关订阅,还包括客户可能购买的任何交易产品。

我的问题是如何在这个数组中找到相关交易?在这种情况下,相关交易将是 triggered the event (例如 CANCEL)。我需要这个交易来更新我们的后端数据库以反射(reflect)当前的订阅状态。例如,将订阅结束日期更新为 cancellation_dateCANCEL 事件上。

我有一个关于 pending_renewal_info 的类似问题大批。根据现有文档,我不清楚是否所有具有有效(甚至可能已过期?)订阅的客户都将始终在此数组中有一个条目。

An array of elements that refers to auto-renewable subscription renewals that are open or failed in the past.

我还需要在此字段中找到相关交易以执行诸如切换 DID_CHANGE_RENEWAL_STATUS 事件的订阅状态或更新 DID_FAIL_TO_RENEW 事件的计费状态等操作。从文档看来,pending_renewal_info 中似乎没有足够的信息来计算当前的订阅续订状态。

总的来说,我的问题归结为:

我能否确定 unified_receipt.latest_receipt_infounified_receipt.pending_renewal_info 中都会有一个与顶级事件 auto_renew_product_id 相匹配的条目?如果是这样,我应该如何在各自的数组中找到相关对象?每个 auto_renew_product_id 是否只有一个条目,还是我应该搜索数组并提取第一个匹配项?

最佳答案

我发现 unified_receipt.latest_receipt_info 数组中的交易是按购买日期从最新到最旧排序的。并确保您可以找到顶级事件 auto_renew_product_id

但是,为了更新订阅状态或计费状态,我利用了 /verifyRecipt 的返回值,您可以通过使用收据数据和密码 (https://developer.apple.com/documentation/appstorereceipts/verifyreceipt) 向 Apple verifyReceipt 服务器请求来获得该值.请注意,输入收据数据是 unified_receipt.latest_receipt,响应与 unified_receipt 具有相同的结构。

关于iOS IAP 订阅/App Store 服务器到服务器通知。将 verifyReceipt API 替换为 unified_receipt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64366199/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com