iOS confirmed purchases not immediately finished

While doing some testing with rapid purchases (10-20 seconds apart) using the Apple sandbox with an iOS app, we would occasionally get duplicated transaction errors when attempting to purchase the same consumable product again.

The flow is setup with a server side verification step, so purchased products are initially set as pending before being confirmed after a server round trip.
We have quite a bit of logging around the steps and can see the product purchase being confirmed before the same product is attempted to be purchased again.

Looking at the receipt data, there are often multiple InAppReceipt objects in a single receipt. These other InAppReceipt’s have already had been consumed before the new transaction was started, sometimes up to 40 seconds prior.

All of the transactions in question did seem to finish correctly after a bit of time without requiring an additional confirm call.

Perhaps this is just Apple being slow to acknowledge the transaction finish, but I haven’t found the Unity source code to be able to confirm that a direct call is being made.

Unity Version: 2019.3.0f6
Unity IAP Version: 1.23.1
Platform: iOS

You are right, Unity IAP will call the store’s API, but the transaction confirmation depends on the store.