Important Info on How IAP's Will Work in an Upcoming Release!
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:
Id: the IAP provider item id.
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.
Name: The localized name of the item.
Price: The localized price of the item.
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.