在服务器端验证 Mac OS X 的消耗品应用内购买
注意:这适用于 Mac OS X,而不是 iOS。
我有一个客户端应用程序,允许在应用程序内购买消费品。收据应发送到服务器,服务器在收到订单时执行某些操作。服务器执行的操作会花费我一些钱,因此我需要格外小心,确保收据有效且仅使用一次。我正在寻找设计这个的最佳方法。
当用户完成购买时,我似乎从 storekit 收到了收据。当我将其发送到我的 Web 服务器(运行 WCF)时,它会通过将 JSON 发布到 Apple 来验证收据。当苹果确认收据时,它会进行需要花费我一点钱的操作。在验证收据部分期间,我的研究告诉我,消耗品收据将始终有效,并且实际上并未“消耗”。我是否应该跟踪提交给我的服务器的每一张收据并确保它没有被使用?我会尽我所能来备份该列表,但我担心它在某个时候会丢失,并希望有另一种方式。
我的另一个担忧是,由于消耗品收据无法通过 storekit 恢复,因此如果发生诸如用户在购买完成后断电之类的情况,那么用户将无法获得产品,因为无法检索该收据。这只是我们必须承担的风险还是我忽略了某些事情?听起来消耗品和非消耗品购买之间的唯一真正区别是您无法恢复消耗品。
NOTE: This is for Mac OS X not iOS
I have a client app which will allow consumable in-app purchases. The receipts should be sent to the server where the server performs some operation when it gets an order. The operation the server performs costs me a bit of money so I need to be extra careful that the receipts are valid and only used once. I'm looking for the best way to design this.
It looks like I get the receipt from the storekit when the user completes the purchase. When I send that to my web server (running WCF) it will verify the receipt by posting the JSON to Apple. When Apple confirms the receipt it will do the operation that costs me a bit of money. During the verify receipt part my research tells me that a consumable receipt will always come up valid and is not actually "consumed". Am I supposed to just track every single receipt ever submitted to my server and make sure it hasn't been used? I will do everything I can to back up that list but I fear it getting lost at some point and am hoping for another way.
My other concern is that since consumable receipts are not recoverable via the storekit that if something happens like the user loses power right when the purchase is completed then the user won't get the product because there is no way of retrieving that receipt. Is that just a risk we have to take or am I overlooking something? It sounds like the only real difference between the consumable and non-consumable purchases is that you can't restore consumables.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我与苹果代表讨论了这个问题。他们基本上说,在当前版本的框架中,无法验证服务器上的可消费收据。
I was able to talk to an Apple rep about this issue. They basically said there is no way to verify a consumable receipt on the server in the current version of their framework.