Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Help with In-App-Purchases Error message

Author
Message
Midget Blaster
AGK Developer
7
Years of Service
User Offline
Joined: 7th May 2016
Location:
Posted: 21st Feb 2018 12:02
I am adding a "no ads" purchase into my game, and I'm struggling a bit. So far, I have a function that sets up information.



But straight up after launching I get an error message "Cannot add IAP after calling InAppPurchaseSetup()"
This function is only ever called one at the start along with all my other functions that are played once. Anyone ever had the same thing?
Furthermore, where do I go from there? I tried adding iap last year but as usual messed it up.



Where do I go from here?

Finally, when you add products, do their ID'S get assigned one buy one starting from 0? so basically
InAppPurchaseAddProductID ( "coins", 0 ) ID = 0?
InAppPurchaseAddProductID ( "mana", 0 ) ID = 1?
InAppPurchaseAddProductID ( "ads", 0 ) ID = 2?

http://lunarhoops.com/
Midget Blaster
AGK Developer
7
Years of Service
User Offline
Joined: 7th May 2016
Location:
Posted: 2nd Mar 2018 20:58
Anyone?

http://lunarhoops.com/
puzzler2018
User Banned
Posted: 2nd Mar 2018 21:26 Edited at: 2nd Mar 2018 21:27
Iv just seen, although this is brand new too to me, i can try give some thoughts

Quote: "InAppPurchaseAddProductID
Description
Use this command to add any product IDs into the list e.g. com.yourcompany.yourproduct.iap. The first product ID you add becomes 0, the second is 1 etc. You must also specify the type of product this is, consumable (1) or non-consumable(0). Consumable products are like coins that can be bought again and again, they are called Unmanaged items by Google Play. Non-consumable products are one off purchases like unlocking the full version of an app, they are called managed items by Google Play. Currently this command is only supported on iOS, Google Play, and Amazon. This must be called before InAppPurchaseSetup, after that no further products can be added. "


Are you deploying out other than Google Play,IOS or Amazon at all?
puzzler2018
User Banned
Posted: 2nd Mar 2018 21:31 Edited at: 2nd Mar 2018 21:35
I suppose head over to the guides area, this seems quiet informative

Press F1 to bring up the commands

Goto Misc

In-App Purchases

and follow your nose through the guides

Example program on there

Quote: "// app title
InAppPurchaseSetTitle ( "your app title" )


// keys for android
InAppPurchaseSetKeys ( "key1", "" )


// products that our app has
InAppPurchaseAddProductID ( "productID1", 0 )
InAppPurchaseAddProductID ( "productID2", 0 )


// initial set up
InAppPurchaseSetup ( )


// restore any non-consumable products on iOS - automatic on Amazon and Android
InAppPurchaseRestore ( )


if GetInAppPurchaseAvailable ( 0 )
// user owns productID1
endif


if GetInAppPurchaseAvailable ( 1 )
// user owns productID2
endif


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
// display info on screen
print ( "waiting to complete purchase..." )

// check if it has finished
if GetInAppPurchaseState ( ) = 1
exit
endif


sync ( )
loop


if GetInAppPurchaseAvailable ( ID ) = 1
// provide the content
endif
endfunction"



Maybe your missing

Quote: "
// keys for android
InAppPurchaseSetKeys ( "key1", "" )
"


Hope this helps get you started

Login to post a reply

Server time is: 2024-03-28 21:07:55
Your offset time is: 2024-03-28 21:07:55