I am using Tier 1 version V2017.01.09
I am having a problem with reinstating a previously purchased IAP product when my app starts. The call to GetInAppPurchaseAvailable ( 0 ) does not return 1. The IAP product has perversely been purchased via Google Play and the purchase process worked fine
1) Should there be a time delay between calling InAppPurchaseSetup ( )and GetInAppPurchaseAvailable ( 0 ) ?
2) Do I need to call InAppPurchaseActivate ( 0 ) before calling GetInAppPurchaseAvailable ( 0 ) ?
3) Do I need to write out to a file when the user originally purchases the IAP product and reference that file every time the app starts?
Any suggestion would be greatly appreciated .
When my app first starts up I check to see if the user has already purchased the IAP product, I am using the correct setup details for my IAP product in the Google play developers console.
InAppPurchaseSetTitle ( "your app title" )
InAppPurchaseSetKeys ( "key1", "" )
InAppPurchaseAddProductID ( "productID1", 0 )
// initial set up
InAppPurchaseSetup ( )
When I call GetInAppPurchaseAvailable ( 0 ) straight after calling InAppPurchaseSetup ( ) it does not return 1, if I try to purchase the IAP product again using the purchase routine below, it states I have already purchased the IAP product and return 1 when GetInAppPurchaseAvailable ( 0 ) is called within the PurchaseRoutine:
if GetInAppPurchaseAvailable ( 0 ) = 1
// user owns productID1
endif
PurchaseRoutine:
do
// buy first product when pointer is pressed
if GetPointerPressed ( ) = 1
BuyProduct ( 0 )
endif
sync ( )
loop
function BuyProduct ( ID as integer )
// start activation
InAppPurchaseActivate ( ID )
// wait until it is done
do
// check if it has finished
if GetInAppPurchaseState ( ) = 1
exit
endif
sync ( )
loop
if GetInAppPurchaseAvailable ( ID ) = 1
// provide the content
endif
return
Kevin