Any help would be greatly appreciated.
When the button is clicked the popup window shows that the payment was $4.99 with a OK button to close the popup. I don’t get the different price options to buy and the code after the “native.showAlert” code does not seem to execute. How should the button code below be structured?
local buyFunction = function( event )
if event.phase == “began” then
audio.play( buttonpress )
function onPaymentComplete(response)
local productName = response.productName
local serviceId = response.serviceId
local coinsAmount = tonumber(response.creditAmount)
native.showAlert(“Fortumo Payment”, response.billingStatus, {‘OK’})
if response.billingStatus == fortumo.BILLING_STATUS_BILLED then
– The payment was successful
coinChange(coinsAmount)
elseif response.billingStatus == fortumo.BILLING_STATUS_PENDING then
– The payment was probably successful (must wait to be sure)
else
– Cancelled or failed
end
end
local request = fortumo.newPaymentRequest()
request:setDisplayString(“Buy Coins”)
request:setService(“xxxxxxxxxxxxxxxxxxxxxxxxx”, “xxxxxxxxxxxxxxxxxxxxxxxxx”)
request:setProductName(“Wizard Coins Android”)
request:setConsumable(true)
fortumo.makePayment(request, onPaymentComplete)
end
if event.phase == “ended” or event.phase == “cancelled” then
--nothing
end
return true
end