Can someone look at this code and see if something stands out? It looks like it store.target never returns true
function buyUpgrade(upgradeItem)
– if ( store.availableStores.apple ) then
– store.init( “apple”, storeTransaction )
– if ( store.availableStores.google ) then
if ( store.target == “google” ) then
store.init( “google”, storeTransaction )
– local alert =native.showAlert(“Made it here!”…tostring(smessage), {“Okay”})
else
showMessage(“In-app purchases are not available on this device.”)
do return end
end
if upgradeItem == “CMD_100” then
store.purchase( “crystals”)
elseif upgradeItem == “CMD_200” then
store.purchase( “200crystals” )
end
end
function storeTransaction( event )
local transaction = event.transaction
local upgradeitem = event.transaction.productIdentifier
local tstate = event.transaction.state
if tstate == “purchased” then
– local timeStamp = utility.makeTimeStamp(transaction.date,“ctime”)
– if timeStamp + 360 < os.time() then – if the time stamp is older than 5 minutes, we will assume a restore.
– showMessage(“map this purchase to a restore”)
– tstate = “restored”
– else – its a purchase
if upgradeItem == “crystals” then
– purchase code here
elseif upgradeItem == “200crystals” then
– purchase code here
end
local alert =native.showAlert(“Purchase Complete!”, “Your support is greatly appreciated!”, {“Okay”})
– end
end
store.finishTransaction( event.transaction )
end