So I'm working on an update to my game Block Ooo that will add some in-app-purchases. I've never messed with iap's before and I'm having a few issues with testing.
This is the code that initializes the iap:
// title of windows
inAppPurchaseSetTitle(getAppName())
// set up first inApp Product (id "net.parallelgames.blockooo.rainbow.bundle" already created on iTunes Connect)
global nRainbowBundleIapId = 0
inAppPurchaseAddProductID("net.parallelgames.blockooo.rainbow.bundle",0)
// activate inApp for AGK
inAppPurchaseSetup()
This is the code that runs when the user clicks the buy button:
inAppPurchaseActivate(Rainbow_Bundle)
do
if getInAppPurchaseState() = 1
if (getInAppPurchaseAvailable(nRainbowBundleIapId) = 1)
// product bought by the player, add your code there
message ("$Rainbow Bundle Bought:)")
nRainbowBundlePurchased=1
SaveIap()
exit
else
// product not bought by the user
message ("$Rainbow Bundle Not Bought:(")
exit
endif
endif
sync()
loop
I have a test iap created in iTunes Connect called net.parallelgames.blockooo.rainbow.bundle and a sandbox account for testing. I run the app through the player to my ios device and when i click the buy button it prompts you for your id and password like it should but then after I type in the id and password the iPod displays the message "Unable to complete your purchase. Please try again later." The most logical explanation is the getInAppPurchaseAvailable(nRainbowBundleIapId) must always be returning 0. Why isn't this working, any help is greatly appreciated.