Hello everyone,
Hoping that someone who has already seen this issue can help me find a solution. I followed the guide of “introduction to android in app billing” from the corona blog. Here is where I am at…
I have included “com.android.vending.BILLING” in my build file
I have uploaded a signed version of my APK
I have set my app to “Active” in google play dashboard
I have created an IAP item and published it in the google play dashboard
I have added a few test users in google play to test my own IAP products
Here is my code:
[lua]–Here is my config file
settings =
{
orientation =
{
default = “landscapeRight”,
supported =
{
“landscapeLeft”, “landscapeRight”
},
},
–[[
iphone =
{
plist =
{
CFBundleIconFile = “Icon.png”,
CFBundleIconFiles = {
“Icon.png” ,
“Icon@2x.png” ,
“Icon-72.png” ,
},
UIAppFonts =
{
“Chantelli Antiqua.ttf”
},
}
}
–]]
android =
{
usesPermissions =
{
“com.android.vending.BILLING”,
},
}
}
– Here is my store code for Android
local M = {}
local store = require(“store”)
local function transactionCallback( event )
local transaction = event.transaction
if transaction.state == “purchased” then
native.showAlert( “IAP TEST”, “Purchased!”, {“OK”})
– Transaction was successful; unlock/download content now
elseif transaction.state == “restored” then
native.showAlert( “IAP TEST”, “Restored!”, {“OK”})
– You’ll never reach this transaction state on Android.
elseif transaction.state == “refunded” then
– Android-only; user refunded their purchase
local productId = transaction.productIdentifier
native.showAlert( “IAP TEST”, “Refunded”, {“OK”})
– Restrict/remove content associated with above productId now
elseif transaction.state == “cancelled” then
native.showAlert( “IAP TEST”, “It Purchased!”, {“OK”})
– Transaction was cancelled; tell you app to react accordingly here
elseif transaction.state == “failed” then
native.showAlert( “IAP TEST”, “Transaction Failed”, {“OK”})
– Transaction failed; tell you app to react accordingly here
end
– The following must be called after transaction is complete.
– If your In-app product needs to download, do not call the following
– function until AFTER the download is complete:
store.finishTransaction( event.transaction )
end
store.init( “google”, transactionCallback )
M.purchaseVolume = function()
– single product purchase
store.purchase( { “android.test.purchased” } )
end
return M[/lua]
When I use the code as is with the “android.test.purchased” then I and all other test users are able to get a transaction completed callback. When I insert my product ID into store.purchase, my test users are returned with: “Item unavailable:
the item you requested is not available for purchase”
For me when I try it pulls up the purchase screen in google play and gives me an error when I try to purchase but it still gives me a transaction complete call back.
Any thoughts about what I am missing here? Do you need to wait a day for google play to update IAP products and push them live?
Also as you can see in my build code, I have the iphone area commented out because I can’t get that and the android code to play together well, if anyone knows the proper coding of this it would be appreciated. Thanks so much [import]uid: 19620 topic_id: 29347 reply_id: 329347[/import]