Server side receipt validation for non-consumable products in iOS7 and transactionReceipt deprecation

核能气质少年 提交于 2019-12-03 07:18:48

问题


I'm porting a working application from previous iOS's and am having trouble with the new in app purchase receipts.

The way we work now is to take the transactionReceipt property from the SKPaymentTransaction object and send it to the server for validation.

From what I could gather from other questions, it seems that the receipt is now held in one place, being :

[[NSBundle mainBundle] appStoreReceiptURL];

There are a few things I don't understand here :

  1. Is there now one receipt for all of the purchased products?
  2. If so, does this file grow and grow and grow?
  3. If I want to send single receipts for single products to the server, how can I?
  4. Is the only way to send the full file to the server all the time?

Very confused by this, any help would be greatly appreciated.


回答1:


From what I've been able to gather via Apple's documentation.

1) There is one receipt for all purchased products. In order to perform server side validation you send the entire receipt to your server, which forwards it to Apple for verification. See this post on the Apple Developer Forums (starting around comment 13) https://devforums.apple.com/thread/193893?tstart=0

2) Non-consumables will remain in the receipt forever, so yes it will grow and grow. Consumables are removed lazily from the receipt once finished via a call to finishTransaction. See https://devforums.apple.com/message/876265#876265

3) The iOS6 way of looping through updatedTransactions and sending individual receipts to your server for validation seems at odds with the new iOS7 design. This post on the Apple Developer forums suggests you "Send the whole list of transactions to your server with the receipt. When the receipt is verified, deliver all of the products, and finish all of the transactions." https://devforums.apple.com/message/897870#897870

4) That really does seem to be the case.

If you believe the iOS7 documentation is lacking you can raise a bug report with Apple



来源:https://stackoverflow.com/questions/19158857/server-side-receipt-validation-for-non-consumable-products-in-ios7-and-transacti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!