恢复收据和购买收据之间的歧义
我很困惑使用服务器模型应用应用内购买。
我在 StoreKit 指南中读到:
如果用户尝试购买非消耗性产品或可更新订阅,他们已经 购买后,您的应用程序会收到该项目的**常规交易,而不是恢复交易。然而, 用户无需再为该产品付费。您的应用程序应该同等对待这些事务 到原始交易的那些。
所以告诉我我怎么知道用户是否已经购买了该物品或者他已经恢复了该物品???
I'm quite confused applying InApp Purchase using a server model.
I read this in the StoreKit Guide:
If the user attempts to purchase a nonconsumable product or a renewable subscription they have already
purchased, your application receives a **regular transaction for that item, not a restore transaction. However,
the user is not charged again for that product. Your application should treat these transactions identically
to those of the original transaction.
So tell me how will i knw that whether the user has purchased the item or he has restored the item????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该跟踪已购买的商品,并将其从用户必须购买的选项列表中删除。
如果您这样做,用户将永远不会尝试购买他们已经打孔的东西。
首次安装应用程序时,您可能想要恢复以前购买的项目(如果有)。为此,您可以调用
restoreCompletedTransactions
,并获得正常的单独回调:paymentQueueRestoreCompletedTransactionsFinished:
。来回答你的问题。
恢复的项目通过
paymentQueueRestoreCompletedTransactionsFinished:
方法购买的项目通常通过 < code> paymentQueue:updatedTransactions: 方法
正常购买且已付款的商品进入在
paymentQueue:updatedTransactions:
方法上。你无法区分 2. 和 3. 之间的区别。这是故意这样做的。
You should keep track of the items that have been purchased and remove them from the list of options the user has to buy.
If you do this, the user will never attempt to purchase something they have already punched.
When the app is first installed you may want to restore items that have been previously purchased (if there are any). To do this you call
restoreCompletedTransactions
and you get a separate callback to normal:paymentQueueRestoreCompletedTransactionsFinished:
.To answer your question.
Restored items come in on the
paymentQueueRestoreCompletedTransactionsFinished:
methodItems purchased normally come in on the
paymentQueue:updatedTransactions:
methodItems purchased normally, which have already been paid for, come in on the
paymentQueue:updatedTransactions:
method.You can not tell the difference between 2. and 3. This is done on purpose.