Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 473
gillyD Avatar asked Oct 03 '13 12:10

gillyD


People also ask

How to validate receipt in-app purchase?

To test receipt validation, you must run the app on a real device, as it won't work in the simulator. You'll need a Development Certificate and a sandbox account. When testing an app through XCode, the app won't have a receipt by default.

What is receipt validation?

Receipt validation is a way to protect against fraudulent in-app purchases made in the iOS and Android app stores, and is used to ensure transactions occurred as reported.

What is receipt validation in-app purchase?

The Receipt Verification Service (RVS) enables validation of purchases made by your app's users.


1 Answers

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

like image 113
Byron Avatar answered Oct 04 '22 00:10

Byron