Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

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; }
 }
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded