Important Info on How IAP's Will Work in an Upcoming Release!

ForumNinjaForumNinja Key Master, Head Chef, Member, PRO Posts: 554
edited September 2014 in GameSalad Kitchen

Hello again everyone. I've been given some more important information to pass on to you guys, read on!

In order to take advantage of updates with Apple's IAP system (as well as Amazon and Google) the current IAP behaviors are being deprecated, and replaced with new ones. These new behaviors are focused around a new system-created table called PurchaseTable. Important: If a user has a game with a table already called PurchaseTable, they should rename it, save their game, and reload it so the system PurchaseTable can be created.

PurchaseTable has 5 columns: Id, Consumable, Name, Price, State. The users (you guys) need to fill in the Id and Consumable columns; the rest are filled in by the new IAP behaviors.

Definitions of what the 5 columns will hold:

  1. Id: the IAP provider item id.

  2. Consumable: flag that the item is consumable (can be bought multiple times). A consumable item can't be repurchased until . the Consume Item behavior is run.

  3. Name: The localized name of the item.

  4. Price: The localized price of the item.

  5. State: The purchase state of the item. Can be "unpurchased", "pending", or "purchased".

The new IAP behaviors are:

In App Purchase - Request Purchase Data: Sends a message to the IAP provider to get the localized name and price info for items. You pass in the start and end indexes of the PurchaseTable for the items you want to get (if the end index is -1, the last table row will be used). You also have to give it a callback attribute. This works the same as the network behaviors’ callback attribute: it is initialized to 0 when the behavior is run, and set to 1 when the data is received, and -1 if there was an error, such as no network connection.

Note that when displaying IAP item data, show the name and price as given in the table. This will be localized by the IAP provider to the appropriate format for the player.

In App Purchase - Restore Items: Sets the "state" column of any items purchased by the player, including consumable items that haven't been consumed. This behavior should be called near the start of a game, after the purchase table has been initialized. There should also be a way for the player to trigger this behavior, in case the initial call couldn't be made.

In App Purchase - Buy Item: Attempts to buy an item. The item state will be set to "pending" until the item is purchased or canceled. It's important to understand that the purchase may not be completed immediately after, or even during the same session as when the request is made.

In App Purchase - Consume Item: Flags a consumable item as "unpurchased" so it can be purchased again. Until Consume Item is called, a consumable item may not be repurchased.

Lastly, games should be changed to use the new system, as the old IAP behaviors will be removed in a future release of GameSalad.

«13456

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    Interesting - looks like a new set of IAP tutorial vids will be coming soon. ;)

  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    edited September 2014

    The old GameSalad IAP system is official deprecated; please move your games over to this new GameSalad IAP system.

    The next RC 0.12 will have this new system to allow you start moving your games over before the final release.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Thanks @ForumNinja‌

    @BlackCloakGS‌, what happens if the user is offline the first time the app is run? Will the Price, Name and State columns be empty?

    Also...

    @ForumNinja said:
    Until Consume Item is called, a consumable item may not be repurchased.

    Does this mean a user can not buy two bundles of hearts at once?

  • stevejstevej Member, PRO, Chef Emeritus Posts: 435
    edited September 2014

    @Hopscotch said:
    Thanks ForumNinja‌

    BlackCloakGS‌, what happens if the user is offline the first time the app is run? Will the Price, Name and State columns be empty?

    Also...
    Does this mean a user can not buy two bundles of hearts at once?

    1) Yes. Ideally, you should call Request Purchase Data some time before they get to your purchase screen. If they get to the screen and the name/price values are empty, display a message saying that the IAP provider you're using cannot be connected to.

    2) Yes. If you want to have the effect of buying multiple groups of items, you will need to set up a separate purchasable item.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited September 2014

    Thanks @stevej, but I phrased it wrong. I will try again:

    Does it mean that a user can no longer buy two of the same item, one after the other, without first using up the first one?

  • gingagaminggingagaming FREELANCE GS DEV Member Posts: 1,685

    An official GS tutorial would be nice for this one @BlackCloakGS‌ :#

  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    edited September 2014

    @gingagaming we will getting a example template and more in-depth docs to you guys soon.

  • stevejstevej Member, PRO, Chef Emeritus Posts: 435

    @Hopscotch said:
    Thanks stevej, but I phrased it wrong. I will try again:

    Does it mean that a user can no longer buy two of the same item, one after the other, without first using up the first one?

    Yes. "Consume Item" is used to tell the IAP provider that you're acknowledging the purchase, so that a) when Restore Items is called the consumable won't be in the list, and b) the consumable can be purchased again. Ideally this should be the flow of a consumable purchase:

    1) Call Buy Item.
    2) Continue the game until the item's state in the PurchaseTable is set to "purchased".
    3) Adjust an attribute for the amount of the consumable purchased, and save the attribute.
    4) Call Consume Item.

    This does lead to a very, very small time between 3 and 4 where the user could shut down your game, and get the purchase again without paying for it. It is possible to switch 3 and 4, but then you'll get a time where it's possible for the user to lose the purchase. It's up to you to decide which risk is preferable.

    You can pause your game during step 2, but, if you are publishing for iOS, there could be up to a day between when a purchase is requested and when it actually goes through, due to the new family sharing system on iOS.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited September 2014

    Thank you for the detailed explanation @stevej‌ ! Its clear now.

    It also seems like non-consumables can now just be checked against the PurchaseTable (state "Purchased") and no longer need to be maintained in our own separate table?

  • colandercolander Member Posts: 1,610

    @BlackCloakGS said:
    gingagaming we will getting a example template and more in-depth docs to you guys soon.

    I would like to get my hands on this asap. Even a working example with a little commentary in this thread would be a big help. You could do a more polished one after that. It would save us a lot of time and you the headache of answering a barrage of question, a lot of them would be the same questions over and over in multiple threads.

  • stevejstevej Member, PRO, Chef Emeritus Posts: 435

    @Hopscotch said:
    Thank you for the detailed explanation stevej‌ ! Its clear now.

    It also seems like non-consumables can now just be checked against the PurchaseTable (state "Purchased") and no longer need to be maintained in our own separate table?

    Correct. Just call Restore Items to make sure you've got the most recent update.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Great, thank you.

    @stevej said:
    Correct. Just call Restore Items to make sure you've got the most recent update.

    Although this would apply to a self-maintained item cache just as well.
    So we just offer the mandatory "Restore Items" button.

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @Hopscotch said:
    Thank you for the detailed explanation stevej‌ ! Its clear now.

    It also seems like non-consumables can now just be checked against the PurchaseTable (state "Purchased") and no longer need to be maintained in our own separate table?

    @stevej Is what Hopscotch said about non-consumables correct? An example of this would also be helpful. I have two games almost ready for submission that only have "remove ads" and "unlock levels" as IAPs.

  • stevejstevej Member, PRO, Chef Emeritus Posts: 435

    @PhilipCC said:
    stevej Is what Hopscotch said about non-consumables correct? An example of this would also be helpful. I have two games almost ready for submission that only have "remove ads" and "unlock levels" as IAPs.

    For non-consumables, the general flow should be:

    1) Call Buy Item.
    2) Continue the game until the item's state in the PurchaseTable is set to "purchased"

    No other calls needed.

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @stevej That was quick. Thank you sir.

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @stevej Do you think we should wait until Apple introduce Family Purchases, and you guys have had a chance to sort out how GS handles them, before we submit any more apps?

  • lycettebroslycettebros Member, PRO Posts: 1,598

    Wait a minute is this only in the release candidate or is it in a new stable release?
    I assume we need an update if this table is system generated.

  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    edited September 2014

    ...

  • marc_greiffmarc_greiff Member, PRO Posts: 250

    @BlackCloakGS‌ if I submitted a game to apple for review today with IAP, will my current IAP system still be valid?

  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250

    it is valid for iOS 5,6, and 7

  • lycettebroslycettebros Member, PRO Posts: 1,598

    @BlackCloakGS said:
    ...

    Sorry maybe my question was stupid.

  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250

    sorry about that I had entered the wrong info and could not delete my post at the time. We should have 0.12 RC out tomorrow with the 0.12 stable coming out before iOS next week. It will have the new IAP system as well as the encrypted projects.

  • lycettebroslycettebros Member, PRO Posts: 1,598
    edited September 2014

    Great! My question was't stupid! :smile:
    Cool the stable release with encryption and new IAP is most welcome news.

  • games4fungames4fun Member Posts: 185

    Does this mean that the in-apps in our live apps on the app store won't work if someone has iOS 8?

    So essentially we would need to update every app that has in-apps asap before iOS 8 goes live with this new format? This is horrible news if that's the case as millions of people will be updating to iOS 8 asap. On top of that this new in-app method isn't available for us to implement yet. Then we need to wait for apple to review the apps.

    Am I the only one worried about the loss in revenue? Not cool!

  • stahboystahboy Member, PRO Posts: 150

    @games4fun‌

    The GameSalad team is working as fast they can and I believe that you won't lose too much money. :)

  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250

    We are trying to get this to you as fast as possible. I am not sure what Apple with do with older apps the main reason we need to update was to support child request (pending ) purchases . I do know that child request purchases with iOS 8 will not work in our old IAP system. You will need to update to our new IAP system.

  • jigglybeanjigglybean Member Posts: 1,584

    Superb! Just before I start adding IAPs too.

    Like Balls? Then click here! We've 100 coming soon

  • Gamelover456Gamelover456 Member Posts: 378
    edited September 2014

    do these IAPs work with the Kindle Fire Devices and Windows 8?

  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250

    Yes on the kindle fire. No on Windows 8

Sign In or Register to comment.