Newly created Sandbox Test Users share a purchase history preventing me from testing "Restore Purchases" on a new user

No matter how many brand new Sandbox Test Users I create, and restarting the iPhone and restarting XCode, and running "Clean build"...


When I click to "Restore Purchases" and run the SKPaymentQueue.defaultQueue().restoreCompletedTransactions() code, the system return multiple in-app product identifiers that were previously purchased and begins to restore them.


If I've created a brand new test user, why do they have a purchase history? How can I newly test my in-app purchases and restores without this purchase history persisting across my test users?


Thanks so much in advance for your help!

I even just tried creating a Sandbox Test User configured with a different country's iTunes Store, and it still downloaded 8 of my 17 available in-apps when I clicked to restore purchases (the same 8 that it restores with every new test user I try)

Accepted Answer

1) are you logged out of the app store or are you still logged in with one of those older test users?

2) are you sure you have called finishedTransactions for all of your earlier transactions?

THANK YOU!


func paymentQueue(queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
    
        for transaction in transactions {
        
            switch transaction.transactionState {
            
            case SKPaymentTransactionState.Purchased:
                print("Transaction Approved")
                print("Product Identifier: \(transaction.payment.productIdentifier)")
                self.deliverProduct(transaction)
                SKPaymentQueue.defaultQueue().finishTransaction(transaction)
            
            case SKPaymentTransactionState.Failed:
                print("Transaction Failed")
                SKPaymentQueue.defaultQueue().finishTransaction(transaction)
            case SKPaymentTransactionState.Restored:
                print("Transaction Restored")
                SKPaymentQueue.defaultQueue().finishTransaction(transaction)
            case SKPaymentTransactionState.Deferred:
                print("Transaction Deferred")
            
            case SKPaymentTransactionState.Purchasing:
                print("Transaction Purchasing")
            }
        }
    }


I wasn't doing the finishTransaction() call for .Restored - I only had it for .Purchased


Didn't realize that even though restore comes from SKPaymentQueue.defaultQueue().restoreCompletedTransactions() and purchase comes from SKPaymentQueue.defaultQueue().addPayment(payment) they both finish through the paymentQueue:updatedTransactions method

Newly created Sandbox Test Users share a purchase history preventing me from testing "Restore Purchases" on a new user
 
 
Q