I did a test purchase for one of my non-consumables and hasReceipt() returns false in the OnInitialized callback when checking the purchased item on app start (the products “receipt” parameter is also empty).
When I then try to purchase that item again, the Google Play Store returns “You already own this item”, so it is definitely purchased.
It seems that the new IAP package/plugin is quite broken, and it would be great to know to which stable version to roll-back to until the unifed package comes out next year.
It looks like the OnInitialized listener is run and returns the “All good” before whatever code that gives the “Already recorded transaction ” returns its response.
The timing I have is below
[2020/11/27 06:24:56.50971] (Log): MenuController - IAP Button Enabled <= runs when OnInitialised returns
[2020/11/27 06:24:56.53990] (Log): Already recorded transaction kajejaopenek… () <= comes in a few milliseconds later.
To work around this, I’ve installed a coroutine for 0.5 seconds in testing to allow for the “Already recorded transaction…” to complete (varies from 0.02ms to 0.34ms) but it would be super nice to not have to hardcode a coroutine especially since we do not know how long it will take the Google Play store to respond when I roll out into production.
( @Nyankoooo do NOT use 2.2.1, it has some other big issues. 2.1.1 does seem like it should work.
I’m looking to use Google Play Billing Library v3.0.1 so I’m kind of stuck, but I’m not ready to roll into production so I can wait until 2.2.3 comes out…)
I’m not seeing this behavior with the Sample IAP project when testing on my Samsung Galaxy S7 phone. All my non-consumables have receipts, including those purchases made with a previous IAP version, and the current release. I’m using this project, upgraded to the latest IAP Sample IAP Project
Jeff,
After further testing on api 19, 21, & 27 devices, it looks like it is a timing issue, on older hardware, taking longer to get and process the ‘fetch’ from the google play store.
The api 19 & 21 devices (Galaxy s3 & s4) devices were NOT getting the fetch done fast enough (always getting the .HasReceipt being False when run from OnInitialized(). (but after 0.05 seconds to 0.15 seconds, the receipt was there)
Borrowed an API 27 device (Buddies Pixel) and it got the receipt (.HasReceipt was True) from OnInitialized() using v2.2.2.
Thank you so much for getting the team working on this as fast as they did. V2.2.3 fixed this issue!
Greatly appreciate the fix!!