Issue with SKPaymentQueue not finishing transactions

I have an app that implements Non-renewable subscriptions. During development I believe I did not properly finish multiple SKPaymentTransactions. Now every time I build and run the app on device then add an SKPaymentTransactionObserver to SKPaymentQueue.default() some of those transactions show up when paymentQueue(:updatedTransactions:) is called. I’ve tried finishing those transactions but they never seem to actually do so. paymentQueue(:removedTransactions:) does get called some time after my attempt to finish the transactions so I would assume those transactions would be finished but when I build and run the app again on device those same transactions show up again from paymentQueue(:updatedTransactions:).



Now every time I make a purchase for a different ProductId the purchase will go though properly. I handle receipt validation and finish the transaction. If I then attempt to purchase the same non-renewable subscription I get “This In-App Purchase has already been bought” alert. If I restart the app again that last transaction will show up via paymentQueue(
:updatedTransactions:) as if it was never actually finished.



It seem like nothing I do will finish these transactions that seem to linger on forever. 



Is there some other alternative to finishing/clearing these transactions? Am I stuck in this loop forever? :(
I'm having the same issue with consumable products in Sandbox environment (https://developer.apple.com/forums/thread/678105).

The first purchase for a given product goes well but any subsequent purchase for this product will end up by the system restoring the first transaction instead of creating a new one. In the end, the purchase fails as our backend refuses to validate the receipt (the transaction identifier being already validated once).

I made sure all transactions in purchased or restored states are properly finished (the removedTransactions callback being called each time), although the call to finishTransaction may be asynchronous (after our backend (in)validates the receipt). However, each time the app starts or goes to foreground again, the first successful finished transaction keeps on appearing in the SKPaymentQueue as if it had not been finished. Finishing this transaction right away does not change anything.

One sentence worries me in the SKPaymentQueue finishTransaction documentation page :

In rare circumstances, this call might fail, and you'll receive updates for that transaction again.

It looks like we are experiencing this situation but we have no way to check if the call to finishTransaction failed nor why did it fail. Moreover, there's apparently no way to work around this issue and allow subsequent purchases (for the same product).

Also I'm pretty sure I was not experiencing this issue last week (using the same app distributed via Testflight).

I don't know if it's an issue with the Sandbox environment or with the Storekit libs and I cannot test the production environment yet. But I'm not confident at all releasing our first support of in-app purchases.

Aurélien.
It seems at some point in the day today this issue has resolved itself. Not sure how or why and I haven't changed anything that would have fixed the issue. After moving forward I've fixed my code to finish transaction appropriately however I don't exactly have confidence that this issue will not appear again tho especially in a development environment. I wish there at least was some info on how to resolve this issue if it does happen again.
Issue with SKPaymentQueue not finishing transactions
 
 
Q