Hey Guys,
Looking at some guidance at the moment on why my iAP are not working on Android. They are working on iOS fine but when I purchase them on Android using a “Test” account created purposely for this I get the following message " the item you are attempting to purchase could not be found"
works fine when I use the android.test.purchased
I have done the following.
- Published my app in “Beta”
- ensured the SKU / Product ID match from in-game code to on the Android Developer console.
- ensured all my apps are “Enabled”
DEVELOPER CONSOLE
NAME/ID PRICE TYPE LAST UPDATE STATUS
1000 Beetle Juice (beetlejuice1000) AUD 0.99 Managed product 17 Jul 2014 Active
1000 Juice (com.roedangames.beetlejuice.1000juice) AUD 0.99 Managed product 22 Jun 2014 Active
2000 Juice (com.roedangames.beetlejuice.2000juice) AUD 1.99 Managed product 22 Jun 2014 Active
3000 Juice (com.roedangames.beetlejuice.3000juice) AUD 2.99 Managed product 22 Jun 2014 Active
CODE
local currentProductList = nil local appleProductList = { "com.roedangames.BeetleJuice.1000Juice", "com.roedangames.BeetleJuice.2000Juice", "com.roedangames.BeetleJuice.3000Juice" } local googleProductList = { --these product IDs are for testing and are supported by all Android apps (purchasing these products will not bill your account) "com.roedangames.beetlejuice.1000juice", "com.roedangames.beetlejuice.2000juice", "com.roedangames.beetlejuice.3000juice" } local iApResult local function iApListener(event) local transaction = event.transaction; print( "[STORE]: Transaction State is: " .. event.transaction.state ) print( "[STORE]: Pre-Purchase for: " .. event.transaction.productIdentifier) if ( transaction.state == "purchased" ) then print( "[STORE]: Purchasing: " .. event.transaction.productIdentifier ) --1000, 2000, 3000 Juice Purchased if event.transaction.productIdentifier == "beetlejuice1000" or event.transaction.productIdentifier == "com.roedangames.BeetleJuice.1000Juice" or event.transaction.productIdentifier == "android.test.purchased" then print( "You have just purchased 1000 juice" ) native.showAlert("Congratulations", "You have purchased 1000 Beetle Juice for in-game power-ups", {"Ok"}); juice = juice + 1000 elseif event.transaction.productIdentifier == "com.roedangames.beetlejuice.2000juice" or event.transaction.productIdentifier == "com.roedangames.BeetleJuice.2000Juice" then print( "You have just purchased 2000 juice" ) native.showAlert("Congratulations", "You have purchased 2000 Beetle Juice for in-game power-ups", {"Ok"}); juice = juice + 2000 elseif event.transaction.productIdentifier == "com.roedangames.beetlejuice.3000juice" or event.transaction.productIdentifier == "com.roedangames.BeetleJuice.000Juice" then print( "You have just purchased 3000 juice" ) native.showAlert("Congratulations", "You have purchased 3000 Beetle Juice for in-game power-ups", {"Ok"}); juice = juice + 3000 end settings:store( "juice", juice ) settings:save() elseif ( transaction.state == "cancelled" ) then native.setActivityIndicator(false); native.showAlert("Error", "The purchase was cancelled", {"Ok"}); elseif ( transaction.state == "failed" ) then native.setActivityIndicator(false); native.showAlert("Error", "The purchase has failed", {"Ok"}); end store.finishTransaction( event.transaction ) end if ( store.availableStores.apple ) then print( "[STORE]: using Apple Store" ) currentProductList = appleProductList store.init( "apple", iApListener ) elseif ( store.availableStores.google ) then print( "[STORE]: using Android Store" ) currentProductList = googleProductList store.init( "google", iApListener ) else print( "[STORE]: In-app purchases are not supported on this system/device." ) end local function productCallback( event ) --print( "In productIdentifier callback" ) print("showing valid products, There are: " .. #event.products .. " valid products") for i=1, #event.products do print(event.products[i].title) -- This is a string. print(event.products[i].description) -- This is a string. print(event.products[i].price) -- This is a number. print(event.products[i].localizedPrice) -- This is a string. print(event.products[i].productIdentifier) -- This is a string. end print("showing invalidProducts, There are: " .. #event.invalidProducts .. " invalid products") for i=1, #event.invalidProducts do print(event.invalidProducts[i]) end products = event.products end print( "[STORE]: Showing Products:" ) store.loadProducts( currentProductList, productCallback )
--ADD STORE BUTTONS FOR JUICE local function onjuice1000buttonRelease () if store.availableStores.apple then store.purchase( {"com.roedangames.BeetleJuice.1000Juice"} ) else print( "[STORE] Purchasing with Android" ) store.purchase( {"beetlejuice1000"} ) end end
please note I have also tested the above with “com.roedangames.beetlejuice.1000juice”