Economy
The Economy system provides a complete monetization and progression framework for your game. It handles virtual currencies, in-app purchases, rewarded video ads, donations, and complex reward mechanics.
Key features #
Virtual currencies #
Define multiple in-game currencies that players can earn through gameplay or purchase with real money. The system tracks player balances and handles all currency transactions atomically.
Learn more about virtual currencies
Virtual store #
Create stores where players can purchase items, consumables, or currency packs using soft currency (earned in-game) or hard currency (real money via App Store, Google Play, etc.). The system handles receipt validation, purchase intents, and reward grants.
Learn more about the virtual store
allow_fake_receipts field is deprecated. It remains in the config schema for backwards
compatibility but has no effect. Use
SetAllowFakeReceipts
in your server
module initialization code instead.Rewarded video #
Integrate rewarded video ads from ironSource or AppLovin MAX. Players watch ads in exchange for in-game rewards. Hiro handles server-side webhook verification and provides automatic fallbacks if callbacks don’t arrive.
Learn more about rewarded video
Donations #
Enable social features where players can request help and receive contributions from other players. Donors and recipients both receive configurable rewards.
Rewards #
Configure complex reward structures with guaranteed drops, weighted random loot tables, and time-limited modifiers. Rewards can include currencies, items, energy, and more.
Economy configuration #
The Economy system is configured via a JSON file. Here’s an example showing the main sections:
| |
| 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. |
Initialize user #
The initialize_user section defines what currencies and items players start with when they first create an account.
initialize_user only applies when a player first creates an account. Players who created an account before an initialize_user change won’t receive the new items or currencies automatically. For example, if version 1.0 of your game initializes players with 100 coins and version 2.0 increases this to 200 coins, players who signed up before version 2.0 won’t receive the additional 100 coins unless you ReapplyInitializeUser
.| Property | Type | Description |
|---|---|---|
currencies | string:int64 | A map of currency IDs and quantities that a user account should be created with. |
items | string:int64 | A map of item IDs and quantities that a user account should be created with. |
Reapply initialize user to existing players #
Use ReapplyInitializeUser to apply the current initialize_user configuration to an existing account. This grants only the currencies the player has never held and the items they don’t currently own, so existing progress and balances are preserved.
Hiro tracks a version hash of the initialize_user configuration for each player. If the configuration hasn’t changed since the player was last initialized, calling ReapplyInitializeUser is a no-op. See the server framework economy reference
for usage.
Related resources #
- Hiro Store sample project
- Mage Mayhem sample project
- In-app purchase validation : Configure server-side receipt validation for Apple, Google, and other platforms.
