subscription sandbox

Is subscription testing in the sandbox (development) broken? I subscribed to a monthly subscription that I set up and I called finish yet when I call restore transaction it still shows up (and in fact if I subscribe again the next day I now have 2 in the queue)?

Replies

restoreCompletedTransactions will restore any previous purchased IAP.

A purchase and a restoreTransactions will each generate a transaction in the queue. These transactions will remain in the queue until you call finishTransaction on each transaction.

This is my issue. I have called finishTransaction and they still show up.


extension IAPService: SKPaymentTransactionObserver {
    func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        for transaction in transactions {
            
            print (transaction.transactionState.status(), transaction.payment.productIdentifier)
            
            switch transaction.transactionState {
            case .purchasing: break
                
            default:
                print ("calling finish on \(transaction.payment.productIdentifier)")
                queue.finishTransaction(transaction)
                print ("finish returned on  \(transaction.payment.productIdentifier)")
            }
        }
    }
    
    func restorePurchaces () {
        print ("restoring purchases")
        
        paymentQueue.restoreCompletedTransactions()
    }
}