When a user completes a transaction (using the in-app-purchase package from flutter), I know I’m supposed to call:
.completePurchase(Purchase)
However when a user is prompted to purchase an item and they cancel, am I also supposed to call completePurchase?
I’m asking this because if the user then tries to buy the same non consumable product again in the same app session (app hasn’t been closed), there is an output that reads:
[VERBOSE-2:ui_dart_state.cc(177)] Unhandled Exception: PlatformException(storekit_duplicate_product_object, There is a pending transaction for the same product identifier. Please either wait for it to be finished or finish it manually using completePurchase to avoid edge cases., {applicationUsername: null, requestData: null, quantity: 1, productIdentifier: 1, simulatesAskToBuyInSandbox: true}, null)
What is the solution to handling when:
purchases[0].status == PurchaseStatus.canceled
?
When I call .completePurchase(Purchase)
on the cancelled transaction, everything seems to work fine meaning that the user can try again to buy the non-consumable product. But I’m not sure if this is the correct way to handle this situation