Heyzap Payments Integration Tutorials
The following tutorials are designed to guide you through adding Heyzap Payments to your flash game.
The current latest Heyzap developer tools API version is 3.3.1.
Contents
Create Virtual Goods To Sell From Your Game
To use Heyzap Payments, you'll need to download and install the Heyzap tools.
To sell items, features or upgrades from your game, you first need to add these items to your game's inventory
Create virtual goods to sell from your game by going to the developer dashboard, selecting the game you want to add virtual goods into, then selecting the Payments tab.
Next, click the "Add Item" button to begin creating a new item to sell.
Fill in the details about the item you wish to sell (eg. name, description, price, image) and press save. The next screen will then show you example ActionScript code you can use to display the "sell item" screens inside your game.
Show An In Game Store To Sell Goods
Download And Install The Heyzap Tools
To use Heyzap Payments, you'll need to download and install the Heyzap tools.
Once you have created some virtual goods to sell, you can now display a store inside your game which allows players to purchase these items.
Show The In-Game Store
You can show a store popup in your game by pasting the following ActionScript code at the desired point in your code, eg. on a button onRelease event:
Code Snippet:
HeyzapTools.send("showStore");
Example Screenshot:
You will also need to make sure you have set up an event handler for the boughtItem event so you can detect when the player has bought an item:
Code Snippet:
HeyzapTools.addEventListener("boughtItem", function (response:Object) {
trace("User bought item: " + response.item.name)
});
Related API Links:
Messages: showStoreEvents: popupShown, popupClosed, boughtItem
Display A Single Item To Sell
Download And Install The Heyzap Tools
To use Heyzap Payments, you'll need to download and install the Heyzap tools.
Once you have created some virtual goods to sell, you can now display a popup inside your game which allows players to purchase an individual item.
Show The Buy Item Popup
You can show a "buy item" popup in your game by pasting the following ActionScript code at the desired point in your code, eg. on a button onRelease event:
Code Snippet:
HeyzapTools.send("showItem", {item_key: "example_item"});
Example Screenshot:
You will also need to make sure you have set up an event handler for the boughtItem event so you can detect when the player has bought the item:
Code Snippet:
HeyzapTools.addEventListener("boughtItem", function (response:Object) {
trace("User bought item: " + response.item.name)
});
Related API Links:
Messages: showItemEvents: popupShown, popupClosed, boughtItem
Customizing Your In Game Currency
To use Heyzap Payments, you'll need to download and install the Heyzap tools.
You can fully customize your in-game points currency by changing the currency's icon and name.
Go to your developer dashboard and click the "Edit Game Details" button on the Summary tab for your game.
You can now change your currency's name and icon under the "Advanced Options" section at the bottom of the page.
Integrating Currency Into Your Game
To use Heyzap Payments, you'll need to download and install the Heyzap tools.
Your game may already have its own currency, like gold. To engage users and increase CPM, synchronize this currency with Heyzap points.
First, add the following code to your event handler for userChanged: myInGamePoints = response.user.points_balance. (Replace "myInGamePoints" with your own currency variable.) This line should be called whether or not "response.user.registered" is true.
Also, detect when a user's points are changed from Heyzap. For example, if a user shares your game on Facebook, we reward them with points. Set up your event handler for userPointsChanged: myInGamePoints = response.points. (Replace "myInGamePoints" with your own currency variable)
To give a user points, call giveUserPoints.
To take points away from a user, call subtractUserPoints.
Related API Links:
Messages: giveUserPoints, subtractUserPointsEvents: userChanged, userPointsChanged


