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
| const request = new EconomyDonationClaimRequest();
request.donation_ids = ["donation_1", "donation_2"];
const donationRewards = await hiroClient.economyDonationClaim(session, request);
console.log(donationRewards);
|
Donate to a user
#
Donate some resource (currencies, items, etc.) to a user by donation ID.
1
2
3
4
5
6
| const request = new EconomyDonationGiveRequest();
request.user_id = "user_id";
request.donation_id = "donation_1";
const updateAck = await hiroClient.economyDonationGive(session, request);
console.log(updateAck);
|
Get donation progress
#
Get progress on one or more donations for a set of players by their IDs.
1
2
3
4
5
| const request = new EconomyDonationGetRequest();
request.ids = ["donation_1", "donation_2"];
const donations = await hiroClient.economyDonationGet(session, request);
console.log(donations);
|
Request a donation
#
Request a donation which other players can contribute into.
1
2
3
4
5
| const request = new EconomyDonationRequest();
request.id = "donation_1";
const donationAck = await hiroClient.economyDonationRequest(session, request);
console.log(donationAck);
|
Get store items
#
Get all store items defined in the Virtual Store.
1
2
3
4
5
| const request = new EconomyListRequest();
request.store_type = EconomyStoreType.AppleAppStore;
const economyList = await hiroClient.economyStoreGet(session, request);
console.log(economyList);
|
Grant currencies or reward modifiers
#
Grant one or more currencies or reward modifiers to te player.
1
2
3
4
5
6
7
| const request = new EconomyGrantRequest();
request.currencies = {
"coins": "100"
};
const updateAck = await hiroClient.economyGrant(session, request);
console.log(updateAck);
|
Store Types
#
Currently supported Store Types for purchases:
- EconomyStoreType.Applestore
- 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
| const request = new EconomyPurchaseIntentRequest();
request.item_id = "item_1";
request.store_type = EconomyStoreType.AppleAppStore;
request.sku = "sku_1";
await hiroClient.economyPurchaseIntent(session, request);
|
Purchase a store item
#
Purchase a store item by the player.
1
2
3
4
5
6
7
| const request = new EconomyPurchaseRequest();
request.item_id = "item_1";
request.store_type = EconomyStoreType.AppleAppStore;
request.receipt = "<receipt>";
const purchaseAck = await hiroClient.economyPurchaseItem(session, request);
console.log(purchaseAck);
|
Get ad placement status
#
Get the current status on an Ad placement which may have been rewarded.
1
2
3
4
5
6
7
| const request = new EconomyPlacementStatusRequest();
request.reward_id = "reward_1";
request.placement_id = "placement_1";
request.count = 0;
const placementStatus = await hiroClient.economyPlacementStatus(session, request);
console.log(placementStatus);
|
Start a new ad placement
#
Start a new Ad placement by placement ID.
1
2
3
4
5
| const request = new EconomyPlacementStartRequest();
request.placement_id = "placement_1";
const placementStatus = await hiroClient.economyPlacementStart(session, request);
console.log(placementStatus);
|
Placement success
#
Webhook RPC to handle Rewarded Video Ad placement success callbacks.
1
| await hiroClient.economyPlacementSuccess(session);
|
Placement fail
#
Webhook RPC to handle Rewarded Video Ad placement failure callbacks.
1
| hiroClient.economyPlacementFail(session);
|