In-App Purchases, restore / load?

MarcoColMarcoCol Member, PRO Posts: 279
How can I save the boolean of an non-consumable in-app purchase?
Simple in the "Thank-You-Screen" after buying the In-App and load then on game-start?
I thought it will be detected automatically when loged in, that the user own this In-App, but it didn't...

Or is there the danger with this load attribute-behavior, that the game will free for all? No, right? Because it wouldn't be saved till the user gets to this screen and he gets only there after buying the In-App...?!

Comments

  • ShmirlyWhirlShmirlyWhirl Member Posts: 189
    Yes, if you save after the purchase gets made, you can load it back up. Users who have not purchased it will load the default value, which would be false.

    But you still need to have the 'Restore IAP" feature somewhere. That is an Apple requirement.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited May 2013
    Yes once the purchase is made you should be updating a table where that info is stored. So the new data should be written to a table and the table saved right after the purchase. And you also need to have a button where you put the restore purchase behavior.

    Here is how I did it.

    When the purchase is made it switches a Boolean game.adsoff to true.

    Rule

    When attribute game.adsoff is true

    Write to table

    IAP.TBL

    Row 1

    Colum 1

    True

    Timer

    After .02 (.02 is one pass of code this time to be sure the write happens before the save)

    Save table IAP.TBL


    Now in your start scene

    Change attribute game.adsoff to TABLECELLVALUE (IAP.TBL.1,1)
  • MarcoColMarcoCol Member, PRO Posts: 279
    edited May 2013
    Thank you.
    What must the Restore-Button do? And where must it be placed?
    I didn't see it in other games?!

    @FryingBaconStudios: I can do this also by loading/saving attribute of the boolean, right?
  • richiconrichicon Member, PRO Posts: 55
    According to the Cookbook the booleans auto-save. See in here under Saving/Loading:

    http://cookbook.gamesalad.com/tutorials/5/parts/26
  • MarcoColMarcoCol Member, PRO Posts: 279
    Is the restore button really needed?
    If I delete the app from the device and install a new version. Then I get to the screen to buy it. And then I got the message, that I already pay for it, if I would get it again for free.
    In the cookbook, there is also the info, that it is not currently a requirement - or was that an older one?

    regarding the load / save of the boolean:
    I save the boolean att after the buy-process and load it at the game start. I didn't do that with saving/loading in the table but with the simple save/load att.
    It's the same, right?
    In my test it works.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited May 2013
    Yes if you don't have it apple will reject you. Restore button grabs the data stored on apple's servers related to that person's account and if they bought a new phone and already own your game when they install it from iTunes and hit restore all the no consumables they bought get restored.

    Why are you so resistant on using a table? It is better to use a table for tons of reasons.
  • MarcoColMarcoCol Member, PRO Posts: 279
    But why didn't I fount such a button in other games?

    That may be, but I have only this one boolean for InApp.
    I work with tables, but not saving anything there.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited May 2013
    Because many apps have a separate scene for IAP that you don't see until you purchase something. I'm not going to debate this with you. Go ahead and submit your app without it and see what happens. If you think I'm making this up read this from the iTunes developer guide, which you might want to read.

    "...if your application supports product types that must be restorable, you must include an interface that allows users to restore these purchases. This interface allows a user to add the product to other devices or, if the original device was wiped, to restore the transaction on the original device."
  • MarcoColMarcoCol Member, PRO Posts: 279
    I didn't want to debate something with you :)
    Must the restore-button on the same scene, where the user has the chance to buy the complete game or can/must it be at another position?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I would recommend reading the iTunes developer guide section on IAP
  • MarcoColMarcoCol Member, PRO Posts: 279
    Ok
  • MarcoColMarcoCol Member, PRO Posts: 279
    When I use restore, is there a chance to display a success-screen like if i use the buy-behavior? The can nothing set in the restore behavior...

    Also the question, if the restore-button must have a fixed position in the game, or if it is enough place it next of the buy-button.
Sign In or Register to comment.