Economy
#
Read more about the Economy system in Hiro here.
Donation claim
#
Claim one or more rewards which are partially or full donated by other players.
1
2
3
4
5
| var request := Hiro.EconomyDonationClaimRequest.new()
request.donation_ids = ["donation_1", "donation_2"]
var donation_rewards = await hiro.economyDonationClaim(session, request)
print(donation_rewards)
|
Donate to a user
#
Donate some resource (currencies, items, etc.) to a user by donation ID.
1
2
3
4
5
6
| var request = Hiro.EconomyDonationGiveRequest.new()
request.user_id = "user_id"
request.donation_id = "donation_1"
var update_ack = await hiro.economyDonationGive(session, request)
print(update_ack)
|
Get donation progress
#
Get progress on one or more donations for a set of players by their IDs.
1
2
3
4
5
| var request := Hiro.EconomyDonationGetRequest.new()
request.ids = ["donation_1", "donation_2"]
var donations = await hiro.economyDonationGet(session, request)
print(donations)
|
Request a donation
#
Request a donation which other players can contribute into.
1
2
3
4
5
| var request = Hiro.EconomyDonationRequest.new()
request.id = "donation_1"
var donation_ack = await hiro.economyDonationRequest(session, request)
print(donation_ack)
|
Get store items
#
Get all store items defined in the Virtual Store.
1
2
3
4
5
| var request = Hiro.EconomyListRequest.new()
request.store_type = Hiro.EconomyStoreType.AppleAppstore
var economy_list = await hiro.economyStoreGet(session, request)
print(economy_list)
|
Grant currencies or reward modifiers
#
Grant one or more currencies or reward modifiers to te player.
1
2
3
4
5
6
7
| var request = Hiro.EconomyGrantRequest.new()
request.currencies = {
"coins": "100"
}
var update_ack = await hiro.economyGrant(session, request)
print(update_ack)
|
Store Types
#
Currently supported Store Types for purchases:
- EconomyStoreType.AppleAppstore
- EconomyStoreType.GooglePlay
- EconomyStoreType.Fbinstant
- EconomyStoreType.Discord
Send a purchase intent
#
Send a marker of intent to purchase by the player.
1
2
3
4
5
6
| var request = Hiro.EconomyPurchaseIntentRequest.new()
request.item_id = "item_1"
request.store_type = Hiro.EconomyStoreType.AppleAppstore
request.sku = "sku_1"
await hiro.economyPurchaseIntent(session, request)
|
Purchase a store item
#
Purchase a store item by the player.
1
2
3
4
5
6
7
| var request = Hiro.EconomyPurchaseRequest.new()
request.item_id = "item_1"
request.store_type = Hiro.EconomyStoreType.AppleAppstore
request.receipt = "<receipt>"
var purchase_ack = await hiro.economyPurchaseItem(session, request)
print(purchase_ack)
|
Get ad placement status
#
Get the current status on an Ad placement which may have been rewarded.
1
2
3
4
5
6
7
| var request = Hiro.EconomyPlacementStatusRequest.new()
request.reward_id = "reward_1"
request.placement_id = "placement_1"
request.count = 0
var placement_status = await hiro.economyPlacementStatus(session, request)
print(placement_status)
|
Start a new ad placement
#
Start a new Ad placement by placement ID.
1
2
3
4
5
| var request = Hiro.EconomyPlacementStartRequest.new()
request.placement_id = "placement_1"
var placement_status = await hiro.economyPlacementStart(session, request)
print(placement_status)
|
Placement success
#
Webhook RPC to handle Rewarded Video Ad placement success callbacks.
1
| await hiro.economyPlacementSuccess(session)
|
Placement fail
#
Webhook RPC to handle Rewarded Video Ad placement failure callbacks.
1
| hiro.economyPlacementFail(session)
|