Issue with Offer Code Redemption: SKPaymentQueue Observer Not Notified in StoreKit

I'm developing an iOS app that supports in-app purchases and I'm using StoreKit2 for handling transactions. While purchase, promotion, and restore purchase functionalities are working fine, I'm facing an issue with offer code redemption.

When I present the offer code redemption sheet using:

``SKPaymentQueue.default().presentCodeRedemptionSheet()``

I am able to redeem the offer code in App Store sheet. It's showing success. But after offer code redeem SKPaymentTransactionObserver does not seem to receive any updates or notifications. Specifically, the paymentQueue(_:updatedTransactions:) method is not being called.

public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])

import StoreKit

`class YourClass: NSObject, SKPaymentTransactionObserver {
    override init() {
        super.init()
        SKPaymentQueue.default().add(self)
    }

    deinit {
        SKPaymentQueue.default().remove(self)
    }

    public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        for transaction in transactions {
            switch transaction.transactionState {
            case .purchased:
                print("Transaction Purchased")
                SKPaymentQueue.default().finishTransaction(transaction)
            case .failed:
                print("Transaction Failed")
                SKPaymentQueue.default().finishTransaction(transaction)
            case .restored:
                print("Transaction Restored")
                SKPaymentQueue.default().finishTransaction(transaction)
            case .deferred:
                print("Transaction Deferred")
            case .purchasing:
                print("Transaction Purchasing")
            @unknown default:
                print("Unknown Transaction State")
            }
        }
    }
}
`

So I am not able to update the UI and also not able to send the details to server.

Steps I’ve Taken:

  • Verified that the observer is added to the SKPaymentQueue in the initializer and removed in deinit.
  • Tested on a real device, not just the simulator.
  • Checked that the offer code is valid and properly set up in App Store Connect.
  • Verified that the latest version of Xcode is being used.

Questions:

  • Is there a known issue with offer code redemption in StoreKit2 that might cause the observer not to receive notifications?
  • Are there additional steps or configurations required to ensure that the transaction observer is notified about offer code redemptions?
  • Are there any common pitfalls or troubleshooting tips for dealing with this issue?
  • Any assistance or insights would be greatly appreciated!
Issue with Offer Code Redemption: SKPaymentQueue Observer Not Notified in StoreKit
 
 
Q