- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
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
, andproduct_id
for each transaction, as a best practice to store transaction records for each customer. App Store generates a new value fortransaction_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 theoriginal_transaction_id
. For subscriptions, it indicates the first subscription purchase. For a restore or renewal, thetransaction_id
does not match theoriginal_transaction_id
. If a user restores or renews the same purchase multiple times, each restore or renewal has a differenttransaction_id
.
还要注意Receipt Validation Programming Guide (来自文档文件)交易标识符下的状态:
This value corresponds to the transaction’s
transactionIdentifier
property.
考虑到这一点,我的问题是:SKPaymentTransaction.transactionIdentifier
何时与已验证收据的 transaction_id
值相同,或者何时不是?
在我们的应用中,我们仅处理消费品应用内购买,不支持订阅。在这种情况下,这两个值相同吗?我之所以这么问,是因为我需要能够在服务器端记录购买情况以及有关购买它的用户的信息。请参阅下面的过程和它所呈现的问题的解释。
假设用户购买了消费品,并且记录该交易的请求失败,因为我们的服务器已关闭,因此我们不调用 finishTransaction:
。现在,假设该人注销并登录到不同的用户帐户并购买了另一种消费品,但我们再次无法记录它。收据中现在有两种消耗品。当他们启动应用程序时,接下来会使用 transactions
数组中的两项来调用 paymentQueue(_:updatedTransactions:)
,以通知我们有已购买
交易需要完成。我们需要将收据提交到我们的服务器来记录交易,但我们还需要随每笔交易发送一些附加信息,例如购买它的用户 ID。这意味着我需要将此信息与关联的 transactionIdentifier 一起保存在磁盘上,以便稍后获取该数据。我可以将一组用户 ID 和收据发送到服务器。但是后端如何知道收据中的哪笔交易与数组中的哪个用户 ID 匹配呢?我不相信 in_app
数组保证以任何特定方式排序,并且可能与提供给 paymentQueue(_:更新的交易:)
。那么,当需要记录多笔交易时,我们如何正确链接它们,以便将购买应用于正确的用户帐户服务器端?在这种情况下,应用内可用的 transactionIdentifier
是否保证与已验证收据中的 transaction_id
相同?
最佳答案
在测试中,我们确定 transactionIdentifier
与经验证的消耗品购买收据中的交易 transaction_id
值相同。
但是,我们不愿意相信这种情况,因为文档中的注释指出它可能不是相同的值。因此,我们使用 transaction. payment.productIdentifier
和 transaction.transactionDate
的组合来唯一标识交易,即 documented与收据中的original_purchase_date_ms
相对应。这允许后端在应用提交的信息的收据中找到正确的交易。
关于ios - 在什么情况下 SKPaymentTransaction.transactionIdentifier 与已验证收据的 transaction_id 相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59556804/
当我购买了一个(免费的)非消耗性应用程序内“包”,然后从设备上清除该应用程序并重新安装它时,“包”的后续“购买”请求会导致该应用程序商店提示用户再次下载,在说他们已经购买之后 - 太棒了。正是我想要的
我正在将我当前应用程序的 IAP 代码与我们的后端服务器绑定(bind)在一起。我想做的一件事是也用它来记录取消和/或失败的交易。 这提出了一个问题,即这些类型交易的交易标识符是否被认为是唯一的?更具
SKPaymentTransaction.transactionIdentifier 的文档备注: This value has the same format as the transaction’
我是一名优秀的程序员,十分优秀!