- Home /
Prime31 StoreKit: How to restore multiple purchases?
I am implementing a way for users to restore past transactions using the restoreCompletedTransactions() method, but I am having difficulty resolving the restoration. Specifically, I cannot find out how many transactions need to be resolved when users start the restoration.
With normal purchases, I disable all user input and subscribe my methods to onPurchaseSuccessfulEvent, onPurchaseFailedEvent etc. After the transaction is resolved I do my "closing processes" (re-enable user input, unsubscribe my methods from StoreKitManager events etc).
This works fine when purchasing a single product, but, I cannot do this when restoring multiple products because I don't know when to execute my closing processes. I cannot simply execute my closing processes after the first transaction is resolved because there may be more transactions to handle.
I have a number of plausible solutions, but none seems ideal:
1) Use StoreKitBinding.getAppStoreReceiptLocation(), parse the receipt to find the number of transactions that need to be resolved (Problem: This only works on iOS7).
2) Execute closing processes after a certain amount of time has elapsed (Problem: This would be unreliable).
3) Execute closing processes after restoreTransactionsFinishedEvent is fired. (Problem: "this event will almost always fire before each individual transaction is processed".)
How can I find out how many transactions need to be resolved when users start the restoration? Alternatively, is there a way that I can get a list of all of their past purchases that works on iOS6 and earlier?
I would prefer to do all of this without digging into Objective-C or XCode, but I'm not sure whether that's possible.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135248im_/https://answers.unity.com/themes/thub/images/avi.jpg)