Summary:
If users only use the OnPurchasePending callback, duplicate transactions can occur for the same order, even after confirmation, during app initialisation. Using FetchPurchases resolves the issue and ensures accurate purchase tracking.
Symptoms:
- OnPurchasePending is fired more than once for the same order.
- A pending event is received after the purchase has already been confirmed.
- Analytics or other logic is executed twice for a single transaction.
Cause:
- Users only use OnPurchasePending and don't take advantage of FetchPurchases.
- Store backend timing (Apple/Google) can briefly report purchases as pending even after successful confirmation on Unity’s side.
Resolution:
- Use FetchPurchases at startup and don't only use OnPurchasePending. When FetchPurchases runs, Unity IAP automatically receive any pending orders(any unconfirmed purchases that still require ConfirmPurchase(), as well as all confirmed purchases (non consumables + subscriptions)