iosin-app-purchasereceipt-validation

What is the point of checking the transactions queue if we can just check the receipts?


For Apple in app purchase, it seems we are supposed to observe the transactions queue:

for (SKPaymentTransaction *transaction in transactions)  {
  switch (transaction.transactionState) {
      case SKPaymentTransactionStatePurchased:
      ...
}

but we also need to validate the receipt (parsing the content at [[NSBundle mainBundle] appStoreReceiptURL]];). But then... can we just take the shortcut to look at the receipt directly? What's the difference?


Solution

  • To validate the receipt you should create custom server and send the receipt to the server. Also receipt contains all transactions and you should find last transaction in it, it is not very easy way to show to a user some message about purchasing. I use transactions for statistics and for quick information and the receipt for validation of purchasing.
    Also you can use receipt for double check of purchasing, if the receipt is not contain appropriate transaction, you can restrict access to the content.