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())
//this is actually async, but for simplicity here it's just a straight return
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. Sometimes the app also gets a lot of old transactions at once on reinstall. 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, and it can be a lot sometimes.
Documentation links are appreciated in answers.