Store Example

This example shows a short demo game for explaining the usage of in-app purchases when using the Store plugin.

Game Setting

The game setting is built around the Californian Gold Rush from the mid eighteen forties (even if the basic user interface might not look like that). The player slips into the role of an American gold digger, trying to gain as much gold nuggets as possible.

In order to be able to dig for gold the player needs some tools. In this scenario the tool of choice is a shovel which can be purchased in exchange with gold in a local store. The shovel's quality is very poor, so every gold dig needs its own shovel. And because not every dig for gold is successful our player might run out of gold, requiring him to purchase some more gold with an in-app purchase if he wants to continue in the game.

As said at the beginning the ultimate goal of this game is to gain as much gold as possible, for the sake of simplicity of this example there is however no condition for winning or losing the game.

The game also contains an ad banner which can be removed by the user with an additional in-app purchase.

Virtual Currencies and Goods

This example uses the built-in virtual economy model. The Store model is defined as followed:

Our Currency of choice is a single gold nugget:

 Currency {
   id: goldCurrency;
   itemId: "currency_gold_id";
   name: "Gold Nugget";
 }

In case the player runs out of gold he can purchase additional nuggets in the platform's app stores with the help of the CurrencyPack item:

 CurrencyPack {
   id: gold10Pack
   itemId: "gold_pack_10_id"
   name: "10 Gold Nuggets"
   currencyId: goldCurrency.itemId
   currencyAmount: 10
   purchaseType:  StorePurchase { id: gold10Purchase; productId: gold10Pack.itemId; price: 0.89 }
 }

We offer our player a second CurrencyPack with a slight discount (it's always best practice to offer different amount/price packs):

 CurrencyPack {
   id: gold50Pack
   itemId: "gold_pack_50_id"
   name: "50 Gold Nuggets"
   currencyId: goldCurrency.itemId
   currencyAmount: 50
   purchaseType:  StorePurchase { id: gold50Purchase; productId: gold50Pack.itemId; price: 3.99 }
 }

Our only good item is a SingleUseGood item:

 SingleUseGood {
   id: shovelGood
   itemId: "shovel_item_id"
   name: "Shovel"
   description: "A shovel to dig for gold nuggets"
   purchaseType: VirtualPurchase { itemId: goldCurrency.itemId; amount: 8; }
 }

Again, we are offering a pack of shovels with a slight discount:

 SingleUsePackGood {
   id: shovelPackGood
   itemId: "shovelpack_item_id"
   name: "5 Shovels"
   goodItemId: shovelGood.itemId
   amount: 5
   purchaseType: VirtualPurchase { itemId: goldCurrency.itemId; amount: 35; }
 }

Finally, we also define a NonConsumableGood to add the option to remove the ad banner on top of the game:

 LifetimeGood {
   id: noadsGood
   itemId: "noads_id"
   name: "No Ads"
   description: "Buy this item to remove the app banner"
   purchaseType: StorePurchase { id: noAdPurchase; productId: noadsGood.itemId; price: 2.99; }
 }

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support