Virtual Store #
A virtual store is a way for players to spend hard currency and/or soft currency to obtain consumables, collectables, or other items relevant in your gameplay. Hard currency can also be used to purchase soft currency.
The virtual store is defined in Hiro using a JSON file and can be configured to support a variety of purchase types, including single purchases and subscriptions. Offers can be configured to be available for a limited time, and can be configured to be available to players who have completed a specific level or have reached a specific score.
Purchase “intents” have been added to the server to allow you to disambiguate on a hard currency purchase between what the user wanted to buy if two store items share the same SKU code (possible with LiveOps configured for the game).
Customization Parameters #
The following JSON represents the customization parameters you can use to configure store items.
|
|
This JSON is for the economy system configuration, but for the sake of this example, only shows store items.
Property | Type | Description |
---|---|---|
initialize_user | InitializeUser | The currencies and items a user should start with when their account is created. |
donations | string:Donation | A map of all donations. |
store_items | string:StoreItem | A map of all store items. |
placements | string:Placement | A map of all placements. |
allow_fake_receipts | bool | Should fake receipts be allowed? A receipt is fake if it contains the string: fake receipt . |
Store Item #
Property | Type | Description |
---|---|---|
category | string | The category that this store item belongs to. |
cost | StoreItemCost | The item’s purchase cost. |
description | string | The description text for this store item. |
name | string | The display-friendly name for this store item. |
reward | Reward | The rewards that a user should receive once they purchase this store item. |
additional_properties | string:string | A map of key value pairs that can contain additional context. |
disabled | bool | Used to make this item non-purchaseable and not return in queries. |
unavailable | bool | Used to make this item non-purchaseable but still return in queries. |
Store Item Cost #
Property | Type | Description |
---|---|---|
currencies | string:int64 | A map of currency IDs and quantities the user must pay to purchase this store item. |
sku | string | The SKU code of the in-app purchase the user must complete to obtain this store item. |
Hard Currency Purchases #
Our Virtual Store supports Hard Currency payments from multiple store types. Currently we support:
- Apple App Store
- Google Play Store
- Facebook Instant Games
- Discord Store
Purchase Flow #
This is the typical flow when purchasing store items with hard currency. Check out the client pages for the specifics based on the engine you are using.
- The User selects an item from the game’s store UI that they wish to purchase.
- A
Purchase Intent
is registered to trigger the specific store provider’s purchasing display. - When the purchase has been completed, a
Receipt
is returned to the client. - The client can then send this
Receipt
to the server to try redeeming the in-game rewards from the purchase. - Upon receiving the
Receipt
, the server will validate it with the specific store provider to make sure that it is legitimate. - If successful, the server will then grant the reward(s) to the player.