In app store setup

Why doesn’t this code for an in-app-purchase work? Also, the store.loadProducts isn’t required right?

[lua]store = require(“store”)

local arrayOfProducts =
{
“com.boltvisual.songs”
}

local listOfProducts =
{
“com.boltvisual.songs”

}

local function onButtonEvent()
if store.canMakePurchases then
store.purchasestore.purchase( {“com.boltvisual.songs”} )
else
native.showAlert(“Arts for Education”, “Sorry, You cannot purchase this product.”, {“OK”})
end
end

local all = widget.newButton{
id = “btn001”,
left = 80,
top = 40,
label = “Unlock All! $4.99”,
width = 320, height = 60,
emboss = true,
onEvent = onButtonEvent
}

function storeTransaction( event )
local transaction = event.transaction
if transaction.state == “purchased” then

local alert = native.showAlert( “Sightread for Education”, “Transaction Successful!”, { “OK”})

doSomething()

elseif transaction.state == “restored” then
local alert = native.showAlert( “Sightread for Education”, “Transaction restored (from previous session)”, { “OK”})

elseif transaction.state == “cancelled” then

local alert = native.showAlert( “Sightread for Education”, “User cancelled transaction”, { “OK”})

elseif transaction.state == “failed” then

local alert = native.showAlert( “Sightread for Education”, “Transaction failed!”…transaction.errorString, { “OK”})

else
end
store.finishTransaction( transaction )
end
end
store.init( storeTransaction )[/lua]

Thank you! Why won’t this work? [import]uid: 59735 topic_id: 21502 reply_id: 321502[/import]

Hi, @ BoltVisual , I’m not so sure about this function on line 17.

store.purchasestore.purchase( {“com.boltvisual.songs”} )

I have a feeling it’s a typo?

Naomi [import]uid: 67217 topic_id: 21502 reply_id: 85095[/import]

Alright I fixed that, thank you! But it still doesn’t work! I have logged into a test account and am using a device. [import]uid: 59735 topic_id: 21502 reply_id: 85200[/import]

Did you get it to work? [import]uid: 5942 topic_id: 21502 reply_id: 118030[/import]

Hi Boltvisul,

I am unable to undersstand the function you entered 17 & 34,Can u give some more information related to these to function,so that i can give u best conclusion or result.

Thanks
Online Apps Promotion [import]uid: 169763 topic_id: 21502 reply_id: 119041[/import]