Thanks for your feedback.
I have a strange problem with my code: I am using the same purchase code from another game where it is working perfectly. I have looked through the code 10 times and it really is identical in usage but somehow I now do not get into the part of the transaction listener which is handling the purchased state.
I first thought it would be the new plugin for billing but it also happened with the old one.
Now I wonder if the “new” states like for example “pending” were sent and catched by the transactionListener with the old plugin also?
I am finishing the Transaction Listener for all states… so does this mean with “pending” I am not allowed to close the Listener, right? Maybe this is the reason I don’t get to the “purchased” state?
What is the best practice for handling the new states and when do you close the listener with store.finishTransaction( event.transaction ) ?
Here is my example for the NOT working listener (Products are tested by getting the correct price for each… so the store also is working correctly)… is there something I am missing?
_G.transactionListener = function( event )
local productID
if ( event.name == "init" ) then
if not ( event.transaction.isError ) then
_G.storeinitsuccesfull=1
productID= event.transaction.productIdentifier
else -- Unsuccessful initialization; output error details
local doitnow=performWithDelay(3000,function() removeShopPopup();initstore() end,1)
end
else
productID= event.transaction.productIdentifier;
if event.transaction.state == "purchased" then
-- THIS PART OF CODE IS NOT GETTING ACCESSED IT SEEMS!
elseif event.transaction.state == "refunded" then
-- handle refunds here
elseif event.transaction.state == "cancelled" then
removeShopPopup()
elseif event.transaction.state == "failed" then
removeShopPopup()
else
removeShopPopup()
end
local doitnow=performWithDelay(2200,function() _G.store.finishTransaction( event.transaction );_G.storeinitsuccesfull=0;removeShopPopup();initstore() end,1)
end
end