verifyReceipt (IAP purchases - iOS/macOS)

Hi folks,

Is anybody else here impacted by the following for verifying IAP receipts on iOS/macOS?

https://developer.apple.com/forums/thread/731550

  • "The verifyReceipt and App Store Server Notification v1 are marked for deprecation which means moving forward the API will not receive any new features and updates. It will continue to function until an end of life date is announced.
  • The end of life date is currently yet to be determined and developer will get a notification in advance prior to end of life.
  • Currently the recommendation is to scope and start using App Store Server API and App Store Server Notification v2 as soon as possible, leveraging existing resources such as available documentation and App Store Server Library."

According to this:

  • “The verifyReceipt endpoint is deprecated. The HTTP header includes the deprecation date, according to RFC 8594.”
    – The HTTP header is “Deprecation = Mon, 5 Jun 2023 23:59:59 GMT”

Best wishes,

Pete

OK, well if any of you make the transition to StoreKit2, it wasn’t too hard, but does require a complete re-write of your IAP handling code.

My top tip - remember to call finish() on all transactions as you complete a verified purchase.

          Task {
            let purchaseResult = try await product.purchase(options: [])
            switch (purchaseResult) {
            case .success(let verificationResult):
              switch verificationResult {
              case .verified(let verifiedSuccessfulTransaction):
                await verifiedSuccessfulTransaction.finish()
                print("verified product:\(verifiedSuccessfulTransaction.productID), expirationDate=\(String(describing: verifiedSuccessfulTransaction.expirationDate))")

Also on app start, for any unfinished transactions. Without doing this, it can really stuff-up your ability to purchase a subscription!

      Task {
        for await unfinishedTransaction in Transaction.unfinished {
          if case .verified(let transaction) = unfinishedTransaction {
            await transaction.finish()
          }
        }
      }

Hoping this helps somebody,

Pete