I'm getting my app repeatedly rejected by apple, saying that it won't allow purchases. The message always comes back the same. "Unable to complete purchase." In the Google Play version of the app, the IAP works just fine.
I have double, triple and quadrouple checked that my IAP reference names are listed correctly, and this, below is the code I'm using. Can someone please give it the yea or nay?
Firstly, when the app starts, I run this code:
global iap_onoff as integer = 0
if (left(getDeviceBaseName(),3) = "ios")
iap_onoff = 1
inAppPurchaseSetTitle(getAppName())
inAppPurchaseAddProductID("WO_COIN_DOUBLER",0)
inAppPurchaseAddProductID("WO_COINS_10K",1)
inAppPurchaseAddProductID("WO_COINS_25K",1)
inAppPurchaseAddProductID("WO_COINS_50K",1)
inAppPurchaseAddProductID("WO_COINS_100K",1)
inAppPurchaseSetup()
endif
if (left(getDeviceBaseName(),7) = "android")
iap_onoff = 1
inAppPurchaseSetTitle(getAppName())
inAppPurchaseAddProductID("android.item.coindoubler",0)
inAppPurchaseAddProductID("android.item.10kcoins",1)
inAppPurchaseAddProductID("android.item.25kcoins",1)
inAppPurchaseAddProductID("android.item.50kcoins",1)
inAppPurchaseAddProductID("android.item.100kcoins",1)
inAppPurchaseSetup()
endif
Then, I have a function in my app for processing purchases. I pass in the index of the purchase which has been chosen by the player as an integer from 0 to 4. It uses this code:
function PurchaseItem(ItemIndex)
RetVal = 0
if (iap_onoff = 1)
inAppPurchaseActivate(ItemIndex)
while (getInAppPurchaseState() = 0)
Sync()
endwhile
if (getInAppPurchaseAvailable(ItemIndex) = 1)
RetVal = 1
else
RetVal = 0
endif
else
RetVal = 0
endif
endfunction RetVal
It SEEMS that the inAppPurchaseActivate command seems to fail each time. But I could be wrong.
I work full-time making games in AGK2 and DBpro. Living the dream!