Double Spend Issue

Hello.
I have a problem of not responsible IAP button (Double Spend error) after an App was closed during Google payment procedure.

Step to recreate bug:

  1. Android build with setup In-App Consumable on Google Play Store
  2. On device initiate payment procedure
  3. Wait till pop window appeared: “You payment was successful” and OK button
  4. DO NOT click on OK button
  5. Quickly closed app
  6. Open app again and press same button.
  7. Button will not react, in console (i using Log Viewer) will appear Double Spend error

Please help me to solve this issue and continue the payment procedure
Thanks

@webprom Do you mean “Duplicate Transaction” perhaps, instead of Double Spend? Could you provide the exact text?

Yes, correct “Duplicate Transaction”

Are you using Codeless IAP, or are you using script? This transaction is likely in Pending state, and may require specific code to mark it as complete. You can see an example of the code in this sample project, using the Toggle button logic Sample IAP Project

Thank you for reply, Jeff!
Yes, i’m using Codeless IAP.
I already looked at the project and used its code to store product ID which was Pending and finished it through Complete function.

  1. How i could iterate through Transaction pending array, in case several pending transactions? Is there some API for that?

You would get a separate ProcessPurchase call for each pending transaction. You could then call ConfirmPendingPurchase for each product https://docs.unity3d.com/ScriptReference/Purchasing.IStoreController.ConfirmPendingPurchase.html

Thanks. I implemented some of this logic, but still can’t figure it out how to make a check if this transaction is Pending or not.

Sorry, let me rephrase this.
If transaction was stacked and how i could check that this transaction was not properly competed?

If you get a ProcessPurchase on normal start up from a previous purchase, the transaction is in Pending. Also, ensure you have this checkbox selected, see attached. Can you provide your device logs? How To - Capturing Device Logs on Android

3593109--291157--Consume.png

Jeff thank you for reply. I used same trick as in demo project save last bought product in variable and launch confirmPending method on start. Downside of this method, that i’m actually can’t check (without server) is that transaction was confirmed or still in pending.

Now it’s works, but i’d like to suggest to add in next updates some native methods to store, check and get Pending transactions.

To troubleshoot this issue further, the device logs would be required. The IAP team requires device logs prior to investigation.