I spent hours yesterday generating builds with higher version codes, uploading those builds to Google Play, waiting for the builds to register, installing the APK by side-load and through alpha testing (with the user accounts registered as testers and with alpha testing access) and with the app in production draft mode. Clearly I’ve missed something because I’m stuck with the same error:
errorType: 5
I/Corona (12913): errorString: Unable to buy item (response: 5:Developer Error)
For passing products, I used a string rather than a table for V2 and V3. The code below has worked fine for the V2 app I have in the store. In recent builds, I went with “android.test.purchased” as the productID rather than live products. Same result.
store.purchase{products.packThree} -- products.packThree = "productID"
I added the appropriate build & config settings:
["plugin.google.iap.v3"] = { -- required publisherId = "com.coronalabs", },
license =
{
google =
{
key = “mykey”,
policy = “serverManaged”,
},
},
The store code is as follows:
local products = require("products") function transactionCallback( event ) print("transactionCallback: Received event " .. tostring(event.name)) print("state: " .. tostring(event.transaction.state)) print("errorType: " .. tostring(event.transaction.errorType)) print("errorString: " .. tostring(event.transaction.errorString)) local tstate = event.transaction.state local transaction = event.transaction if store.availableStores.google and tstate == "purchased" then local timeStamp = products.makeTimeStamp(transaction.date,"ctime") if timeStamp + 360 \< os.time() then -- if the time stamp is older than 5 minutes, we will assume a restore. print("map this purchase to a restore") tstate = "restored" restoring = false end end if tstate == "purchased" then print("Transaction succuessful!", transaction.productIdentifier) if transaction.productIdentifier == products.packOne then --update product variable elseif transaction.productIdentifier == products.packTwo then --update product variable elseif transaction.productIdentifier == products.packThree then --update product variable elseif transaction.productIdentifier == products.packFour then --update product variable elseif transaction.productIdentifier == products.packFive then --update product variable end -- Show alert with one button native.showAlert("Thank you!", "Your support is greatly appreciated!", {"Okay"}) -- elseif tstate == "refunded" then if transaction.productIdentifier == products.packFive then print ("Refunded") --update product variable end elseif tstate == "restored" then if transaction.productIdentifier == products.packFive then print("noAds restored") --update product variable end elseif tstate == "cancelled" then print("User cancelled transaction") elseif tstate == "failed" then print("Transaction failed, type:", transaction.errorType, transaction.errorString) else print("unknown event") end store.finishTransaction( transaction ) --save data to json file --update screen display of quantities end store.init( transactionCallback )