Do I have to verify the receipt for every SKPaymentTransaction for subscriptions?

Published

I am implementing auto-renewable subscriptions in my iOS app. My transaction handling looks something like this pseudocode:

func paymentQueue(_queue: SKPaymentQueue, updatedTransactions transactions:[SKPaymentTransaction]) {
  for (t in transactions) {
    let data = Data(contentsOf: getReceiptUrl())
    if verifyReceiptWithServer(data) == .success {
      print("Verified receipt successfully!")
    }
    queue.finishTransaction(t)
  }
}

If a subscription renews more than once while my app isn’t active, I could get more than one transaction per product here. Do I need to verify every transaction? Or is it better to do just one per productIdentifier? Or maybe even just once per call to paymentQueue:updatedTransactions:? If the receipt data on disk is the same the whole time, then I’m sending the same binary data to my server every time.

Documentation links are appreciated in answers.

Source: Ios Questions

Published
Categorised as ios, receipt-validation, skpaymenttransaction, storekit Tagged , , ,

Answers

For subscriptions, you could just make 1 call for all transactions. What’s important is that you are validating entitlements off the receipt. So as long as your server is looking at the whole receipt, you should be good.

For other IAP types, it’s after to verify for each updated transaction.


Norris Quigley

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq