Ok heres some info after banging my head left right and center.
i found some apps are working correctly and some are not. And i found the difference is when i have
store = require( “plugin.google.iap.billing.v2” )
and initialize it in
main.lua
and then call store.purchase from a scene. It is working as intended. Although a major issue as described in the last paragraph of this.
The issue i was having with the apps that had the multiple purchase states. I had the following in the scene lua file (lets say example shop.lua)
local store = require( “plugin.google.iap.billing.v2” )
and initialize it in the shop.lua file.
What seems to be happening, every time it opens that scene, it is initialising the store over and already initialised store. which should not be the case, as store is set as local store. have never encountered this problem before. It seems each time you initialize the store even if its local it is being stored in memory so each time it is initialized its another instance of it which is active.
Now i have another totally WIERD issue. So if the store is initialised in main.lua. every time i close the app, make sure it is swiped closed and then reopen the app, it starts from the splash screen, it seems to be reinitialising the store even though in the background the previous store seems to be still functioning??? so every time i open the app fresh from the splash screen, for example if i had opened the app twice, the purchase state runs twice. if i close the app and start it fresh again, the purchase state will run 3 times. it seems the transactionCallback is getting stuck in memory and being duplicated everytime it is initialised even if the app is opened from the splash screen hence the multiple purchase.