How do I get all Consumable IAP Transactions with StoreKit 2

Hey all,

I've been using StoreKit 2 lately and I'm so deeply impressed with how much easier it has become.

For a better user experience regarding transaction history, I've built a view that would show every transaction made in the past with the option to request a refund natively.

The only problem I'm facing at the moment is that I can't seem to get a list with all transactions, my app has Non-consumable, Consumable and Subscription IAP and I only get the Non-consumable + Subscriptions when I use the Transaction.all

Does anyone have any idea how I can get the Consumable transactions as well?


Current code

@MainActor
    func getPurchasedProducts() async {
        //Iterate through all of the user's purchased products.
        for await result in StoreKit.Transaction.all {
            if case .verified(let transaction) = result {
                if !self.transactions.contains(transaction) {
                    self.transactions.append(transaction)
                    self.transactions = sortByDate(self.transactions)
                }
            }
        }
    }
Answered by Frameworks Engineer in 684673022

Due to the nature of consumable in-app purchases, it's up to your system to keep track of what content the user is entitled to after you finish a transaction for a consumable product. I would recommend storing all of the information necessary for your app's user experience before finishing consumable transactions.

Accepted Answer

Due to the nature of consumable in-app purchases, it's up to your system to keep track of what content the user is entitled to after you finish a transaction for a consumable product. I would recommend storing all of the information necessary for your app's user experience before finishing consumable transactions.

To see all type of transactions, set SKIncludeConsumableInAppPurchaseHistory to true in the Info.plist.

Transaction.all will have everythin.

How do I get all Consumable IAP Transactions with StoreKit 2
 
 
Q