Hello, I’m a Corona SDK starter.
We are working on Google IAP v3, but fail to consumePurchase() our product.
Our program works as follow,
local store = require("plugin.google.iap.v3") local ourTrans = nil store.init(function(event) ourTrans = event.transaction end) ------------------- while purchase -------------------------- if store.target == "google" then timer.performWithDelay(100, function() store.purchase("our\_product\_identifier") end) repeat coroutine.yield() until ourTrans ~= nil if ourTrans.state == "purchased" then local consumeTrans = nil store.consumePurchase({ourTrans.productIdentifier}, function(event) consumeTrans = event.transaction end) repeat coroutine.yield() until consumeTrans ~= nil end store.finishTransaction(ourTransaction) end
We can buy our product and receive the bill send from google play.
However, our app crash immediately when calling consumePurchase().
The product is “unmanaged type” which can be consumed, I think.
Is our work flow correct?
-
store.init() (only once)
-
when purchase come, store.purchase()
-
if purchase succeed, store.consumePurchase({productIdentifier return by purchase event})
-
store.finishTransaction() after all the calls finishe
Has anyone got the same problem before?
Thanks.