I got in app purchases to mostly work both on iOS and android. I sell coins in my app. I can buy the coins successfully one time but can’t for a second time.
event.transaction.state
returns
failed
when I try to buy it the second time. For iOS first time is successful but second time i get the message you already purchased this but it hasn’t been downloaded.
I want to user to be able to buy more coins right away after buying their first set. So here is what I did.
local function transactionCallback( event ) print("In transactionCallback", event.transaction.state) local transaction = event.transaction local tstate = event.transaction.state if tstate == "purchased" then if transaction.productIdentifier == "com.mygame.item1" then --increment quality of bought item store.consumePurchase({"com.mygame.item1"}, transactionCallback)
This doesn’t work. I still can’t buy for the second time. Im trying to consumePurchase immediately after it is bought. That is why i put it inside of tstate == purchased
Secondly, i think store.consumePurchase() is only for google IAP v3. How can I do this with apple?