Part 2 - Creating Items to Buy

By Richard Davey on 12th March 2019   @photonstorm

Creating In App purchases for Facebook Instant Games is split into two parts. First is the 'admin' side, where you configure the items to be purchased via your App Dashboard on the Facebook site. The other is the 'game' side, which is where your game makes API calls in order to obtain and buy items, based on user interactions.

To get started, you need to create some products to buy. Do this by logging into your Apps Dashboard and clicking the "In App Purchase" menu item in the left-hand nav. Click the "Create New Product" button and a small form will appear:


Every product in your app has to have a unique Product ID. This is used in your game code to both identify items and purchase them. It isn't displayed to the player, so use whatever IDs make sense to you and your game. A Product ID can only contain lower-case letters, underscores, numbers and dots. No other characters are allowed, not even upper-case ones.

The Title and Description help identify your product to your players, if at a later date they check their list of transactions. While you do not need to display these in your game, for example you could have much more elaborate descriptions for your items, you need to provide something here for your players. Naturally, the title should either match exactly, or be easily identifiable, so your player isn't left wondering what it was they bought and potentially dispute the transaction.

The Price should be selected from the drop-down list. You'll notice that the list is pre-defined. For example, you can set a price of $0.99 or $1.99, but not $1.50. You cannot manually enter a price, it has to be on the list, so factor this in when planning out which items your game is going to sell and for how much. You'll notice the price is in US Dollars. The player is actually charged in their local currency, but the amount you earn is based on US Dollars, so factor that in when setting the item pricing.

Finally, pick a 50 x 50 PNG image that represents the item. You do not need to display this image in your game, although you do get a reference to its URL in the API callback. It's more for the players to use when browsing their purchase history.

In our RPG-style Instant Game, gold can be spent to buy upgrades for your character, such as better weapons and armor, and diamonds can be used to train in additional skills. Gold can be earned in-game, of course, via playing the game, but an In App purchase will give the player an instant boost without the grind.

For this tutorial, we'll create 6 products that all offer different boosts in-game. You can see these configured in the image below:


As with most In App game items, the more expensive the item, the more the player gets, and it's not linear either, enticing them to spend a little bit more to get a better percentage deal from it.

These products form what's called our Catalog, which we can now display in-game.