I think your problem is with Sandbox User accounts in iTunes Connect. If you don't have sandbox users, this guide was really useful for setting them up:
https://support.magplus.com/hc/en-us/articles/203809008-iOS-How-to-Test-In-App-Purchases-in-Your-App
If you have Sandbox users:
You can try calling finishTransaction: but you need to make sure transaction SKPaymentTransactionState valid.
In the finishTransaction documentation:
So, to safely delete completed transactions:
for transaction in SKPaymentQueue.default().transactions { guard transaction.transactionState != .purchasing, transaction.transactionState != .deferred else { //Optionally provide user feedback for pending or processing transactions return } //Transaction can now be safely finished SKPaymentQueue.default().finishTransaction(transaction) }
The documentation for .purchasing and .deferred pretty vague:
case purchasing
From what I understand, processing pending and / or processing transactions should be fairly passive. The application has completed everything necessary and is awaiting a response from the iTunes Store server or some other dependency (i.e. payment authorization).
paymentQueue: updatedTransactions: will be called into the SKPaymentTransactionObserver when the transaction is updated.
As far as your transaction queue is stuck in limbo, I bet that all the transactions in your queue are in .purchasing state. This is most likely an iTunes Connect / Sandbox / iTunes Account Production user error. Others, including me, also had this question. There is an error report for this. Try to recreate / change the password of your sandbox user or create a new Sandbox user for testing.
More details here: https://forums.developer.apple.com/thread/70418
source share