How exactly do I use InAppPurchaseRestore(). I want to call it after the user presses a button titled "Restore Purchases", then if it finds the user has previously bought either of my iap's I want it to save this off.
This is the code I am using to do this but the but the problem is getinapppurchasestate() does not work with the restore command and there is no way to tell if the attempted restore has finished. any suggestions?
function RestorePurchasesClicked()
InAppPurchaseRestore ()
do
if (getInAppPurchaseAvailable(nRainbowBundleIapId) = 1)
// product previously bought by the player, add your code there
message ("$Rainbow Bundle Previously Bought:)")
nRainbowBundlePurchased=1
SaveIap()
endif
if (getInAppPurchaseAvailable(nMetalBundleIapId) = 1)
// product previously bought by the player, add your code there
message ("$Metal Bundle Previously Bought:)")
nMetalBundlePurchased=1
SaveIap()
endif
if getInAppPurchaseState() = 0
exit
endif
sync()
loop
message ("$No Bundles Previously Bought:(")
endfunction
nRainbowBundlePurchased and nMetalBundlePurchased are the booleans that are later saved to a file in SaveIap() designating the user has purchased this iap and should recieve the additional content.