Game Development Reference
In-Depth Information
In-app purchases
The popular option for mobile games these days is the in-app purchase . This is a
product that can be bought inside the game that can exist perpetually or be consumed
and repurchased, unlocking or providing whatever you want.
You will begin by creating products in the store dashboard. Here you have to define
the price and expiry time for the product. When the player buys the product, it is active
for the amount of time you specify, which could be forever if you choose that option.
Take note of the IDs at this point as we will use those later.
A consumable is a product that the users can buy as many times as they want. It
gets the name from the fact that the product is consumed immediately, as opposed
to a durable, which lasts perpetually (or until expired). Consumables are often used
for coin purchases where the player might want to buy some coins and then imme-
diately buy some more. Windows 8 does not support this scenario as the minimum
expiry time for a product is 24 hours. This is not a problem as we can work around
this limitation, which we will look at after we understand how to retrieve and purchase
the in-app products.
As you specify the product ID, you can feel free to skip retrieving the product list from
the store and instead insert it directly into your game. This is often the best route as
it lets you perfect the display and icons for each product; however, in some cases (as
outlined in our workaround) we may want to separate the display of the products from
the products that are actually available.
One other thing to note is that the users need to be running the full version of the
game before they can use in-app purchases. If you are selling your game then you
need to ensure that they have active, non-trial licenses, and if not you need to prompt
them to purchase the game. Once they have the game, you can request product pur-
chases and proceed as normal.
Search WWH ::




Custom Search