IAP - When do I request purchase data?

app_sauceapp_sauce Member, PRO Posts: 206

I am setting up an iap for a game. It is a standard remove ads/ no ads iap. I have a button that says "no ads" It is on the gameover screen and start screen (its a single scene game). My question is where should I put the Request purchase data? In the button? And then just trigger the Request when the button is pressed??

I haven't included iaps in any games yet but like the idea of non-consumables. thanks

SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE

Comments

  • ArmellineArmelline Member, PRO Posts: 5,368

    There are two options for when to request the Purchase Data.

    The first is to just have the behaviour run as soon as player reaches the IAP scene. This is easiest, but the problem is that there's a good chance a login popup will appear when you request the data. This will freak some people out. Especially since you need to be repeating the request until the table is actually filled. If you only run it once and they click "Cancel" the first time to the popup, then they'll not be able to do any purchasing. If you're requesting it repeatedly until it fills, they might see this login popup over and over again, further making them think your game is doing shady things.

    The only real option, therefore, is to place the request inside a button. This complicates the logic, but it makes for a much better user experience. Realistically, there are other things you should be doing too - like responding to a failed table fill or a failed purchase, so you might as well do a proper job of it.

    You'll probably get told not to put the request purchase data behaviour in a button, but they'll be wrong. Don't be lazy with the IAP. Do a proper job of it.

    I give a very thorough overview of the logic involved in doing a thorough job of IAP in my free template:

    http://forums.gamesalad.com/discussion/74468/armellines-in-app-purchase-tutorial-template

  • app_sauceapp_sauce Member, PRO Posts: 206

    @Armelline Thanks, I checked out your vid! Here is an image of my code. I dont want the iap login to come up unless the press the remove ads button.
    Did I do this right? thanks
    (https://us.v-cdn.net/5017598/uploads/editor/bu/r2lewkiteqyd.png "")

    SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE

  • ArmellineArmelline Member, PRO Posts: 5,368

    Unfortunately you need to do a fair bit more than that. I'm afraid I don't have time to type it all up now, but your first problem will be that the Buy Behaviour will be triggered as soon as the button is pressed - before the table fill has had time to happen. You need to be telling it to buy only when the callback attribute is 1.

  • Agent ArgyleAgent Argyle Member, PRO Posts: 188

    Hey Armeline. Just thought you should know that your free template returns a 404.

  • xwrbnxxwrbnx Member Posts: 23

    Hi @Armelline ,

    Referring to your suggestion in the previous post above to run the IAP Request purchase data when the user click the Buy button.

    But that means the button will not have the pricing info before the user click the Buy button. We are also suggested by GameSalad cookbook "Do not display purchase info for items until this behavior has been called."

    I want the buy button showing the pricing such as "Buy for USD 1.99".
    However, what I think as solution may cause problems:

    1. I thought of calling the IAP Request purchase data when entering the IAP scene, and displaying the price when the callback = 1.
      Otherwise, hide the Buy button, show the error message ( "Error requesting purchase data. Please check the network." ), and auto retry in 30 seconds.
      But as you said above: the user may encounter repeated login popup.

    2. Some games are able to show the pricing even when we are offline (although we still need to be online when making the purchase). But if I save the price or make the duplicate of the PurchaseTable to get the price and save the duplicate table, it may not be displaying updated price info.

    So what is the best method?
    Or is it acceptable to show buy button only without price info?
    It is a bit weird especially when we have many IAP items (example: Buy button for power, buy button for weapons, costumes, etc. and all actually have different price.). Now I am confused which method to chose.

    Please advise. Thank you very much.

  • ArmellineArmelline Member, PRO Posts: 5,368

    Interesting problems. If you're displaying localised prices, I don't think you have any choice but to call the Request early. When entering the IAP screen makes most sense, but that will still lead to a delay in prices being displayed.

    I'd probably use your second option, but as you say that means you need to update the game to update the prices.

    Unfortunately I don't think anyone can tell you what method to use - you'll make compromises whatever you do. Both 1 and 2 seem good options, but 1 is the safer.

Sign In or Register to comment.