iOS IAP - Local receipt validation vs. storing the purchase on Keychain

258 Views Asked by At

I am implementing in-app purchases and am currently reading up on how to best store the information if you don't have your own server. I came across these two articles by the same author, two years apart:

Before, I thought receipt validation was exclusively done to check if the purchase was authentic/not faked. But seeing this part in the second article:

// (He's using a third-party library TPInAppReceipt)
if let receipt = try? InAppReceipt.localReceipt(){
    if receipt.containsPurchase(ofProductIdentifier: "your.product.identifier"){
        // user has purchased this product
        // return true
    }
}

made me think this is the same as storing the purchase on Keychain, isn't it?

Am I correct in my assumptions, that:

  • Keychain (or anything else that's safe) = only storage of purchase info
  • Receipt = validation of purchase AND storage of purchase info

So is the receipt storage info a new functionality, or why else would someone store purchases somewhere else when you can use the receipt anyway?


Edit: I found this article that seems to confirm my assumptions to some degree:
Implementing In-App Purchases without Keychain and UserDefaults)

The author makes the point that this technique is probably not more widely used because

  1. It only works for non-consumable products and auto-renewable subscriptions
  2. It's hard to implement
0

There are 0 best solutions below