gpt4 book ai didi

iOS StoreKit 交易标识符与收据不匹配

转载 作者:行者123 更新时间:2023-12-04 14:00:55 26 4
gpt4 key购买 nike

我在收到 SKPaymentTransactionStatePurchased 后使用收据来验证购买通知,除其他外,获取用户刚刚购买的订阅的到期日期。

为了正确识别收据中刚刚发生的交易,我通过 transaction.transactionIdentifier 匹配它。和 transaction_id .我遇到的问题是事务标识符永远不会匹配。

通过手动检查 purchase_date,我已经能够识别收据中的正确交易。和 product_id ,但 transaction_id与交易完全不同。

我也看过 transaction.originalTransaction.transactionIdentifieroriginal_transaction_id ,但这四个值似乎在任何时候都不匹配。

这里发生了什么?在沙盒中测试时有人遇到过类似的问题吗?该文档明确指出 transaction_id应该匹配 transactionIdentifier交易的属性(property)。这可能是一个错误吗?

编辑 1:
这是单次购买订阅(之前已过期)的不同交易标识符

transaction.transactionIdentifier = 1000000325087359
transaction.originalTransaction.transactionIdentifier = 1000000297785006
transaction_id = 1000000325087377
original_transaction_id = 1000000297785006

似乎原始交易标识符匹配(为什么他们会,这是一个新购买?),但其他两个不匹配。它们来自哪里,它们匹配什么?我不明白两者之间的关系及其重要性。

最佳答案

SKPaymentTransaction.transactionIdentifier 的文档笔记:

This value has the same format as the transaction’s transaction_id in the receipt; however, the values may not be the same.



以及 transaction_id 的文档笔记:

This value has the same format as the transaction’s transactionIdentifier property; however, the values may not be the same.

You can use this value to:

• Manage subscribers in your account database. Store the transaction_id, original_transaction_id, and product_id for each transaction, as a best practice to store transaction records for each customer. App Store generates a new value for transaction_id every time the subscription automatically renews or is restored on a new device.

• Differentiate a purchase transaction from a restore or a renewal transaction. In a purchase transaction, the transaction_id always matches the original_transaction_id. For subscriptions, it indicates the first subscription purchase. For a restore or renewal, the transaction_id does not match the original_transaction_id. If a user restores or renews the same purchase multiple times, each restore or renewal has a different transaction_id.



我还会注意到 Receipt Validation Programming Guide (来自文档文件)在交易标识符下说明:

This value corresponds to the transaction’s transactionIdentifier property.



除了记录的场景外,我不清楚这两个字段在哪些场景中相同或不同。

关于iOS StoreKit 交易标识符与收据不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45705069/

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