Client Economy API Reference
PGOS provides a series of services to help you build a in-game economy, including virtual currencies, in-game items, stores, and inventory.
API List
| API | Description |
|---|---|
| GetBalances | Get all balances of the player. |
| GetStore | Get the specified store defined on the portal. |
| GetStoreWithPlatform | Get the specified store defined on the portal. This interface can get the value of 'platform_item_mapping'. |
| GetStoreBriefs | Get brief information of specified stores. |
| GetStoreCategories | Get the specified store categories defined on the portal. |
| CreateStoreOrder | Create an order before purchase the specified store item in the store. After committing the order, the PGOS virtual server events event_item_granted/event_currency_changed will be triggered. |
| CommitStoreOrder | After committing the order, the payment will be deducted and the items will be dispatched. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered. The event_custom_data filled in the parameter CreateStoreOrderParams will be passed to these events. |
| QueryStoreOrder | Query order status. |
| GetInventory | Get all item instances in the player's inventory. |
| GetInventoryWithFilter | Get all item instances in the player's inventory. |
| ConsumeInstance | Consume the specified item instance in the player's inventory. The virtual server function bound to the consumer action will be called. |
| OpenContainerInstance | Open the specified container instance in the player's inventory. The PGOS virtual server events event_item_revoked and event_item_granted/event_currency_changed will be triggered. |
| RevokeInstance | Revoke the specified item instance in the player's inventory. The PGOS virtual server event event_item_revoked will be triggered. |
| SetInstanceTags | Update the tags data of the specified item instance in the player's inventory. Instance tags can have up to 32 keys, with each key limited to 128 bytes and each value limited to 1024 bytes(in a narrow-character string). |
| CheckBeforePlatformPurchase | Check before purchasing items on 3rd-party platforms. Used to check situations where items cannot be purchased due to unique items, mapping configuration, etc. |
| SyncPlayerPlatformInventory | Synchronize the 3rd-party platform's inventory to PGOS. It is recommended to call it once after logging in to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered. |
| SyncSteamPlayerInventory | Synchronize the Steam platform's inventory to PGOS. It is recommended to call it once after logging in to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered. |
| SyncSteamPurchase | Synchronize item instances purchased by players from Steam to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered. |
| SyncXboxPlayerInventory | Synchronize the Xbox platform's inventory to PGOS. It is recommended to call it once after logging in to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered. |
| SyncXboxPurchase | Synchronize item instances purchased by players from Xbox to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered. |
Event List
| Event | Description |
|---|---|
| OnInventoryGranted | The event will be triggered when new item instances are granted to player's inventory. |
| OnBalanceUpdated | The event will be triggered when any currency amount changed. |
API Details
GetBalances
Get all balances of the player.
/// <summary>Get all balances of the player.</summary>
public void GetBalances(EconomyDelegate0 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | EconomyDelegate0 |
Return: void
GetStore
Get the specified store defined on the portal.
/// <summary>Get the specified store defined on the portal.</summary>
/// <param name="pgos_params">Request params.</param>
public void GetStore(GetStoreParams pgos_params, EconomyDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | GetStoreParams | Request params. |
| callback | EconomyDelegate1 |
Return: void
GetStoreWithPlatform
Get the specified store defined on the portal. This interface can get the value of 'platform_item_mapping'.
Deprecated, use GetStore instead.
/// <summary>Get the specified store defined on the portal. This interface can get the value of 'platform_item_mapping'.</summary>
/// <param name="pgos_params">Request params.</param>
public void GetStoreWithPlatform(GetStoreWithPlatformParams pgos_params, EconomyDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | GetStoreWithPlatformParams | Request params. |
| callback | EconomyDelegate1 |
Return: void
GetStoreBriefs
Get brief information of specified stores.
/// <summary>Get brief information of specified stores.</summary>
/// <param name="pgos_params">Request params.</param>
public void GetStoreBriefs(GetStoreBriefsParams pgos_params, EconomyDelegate2 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | GetStoreBriefsParams | Request params. |
| callback | EconomyDelegate2 |
Return: void
GetStoreCategories
Get the specified store categories defined on the portal.
/// <summary>Get the specified store categories defined on the portal.</summary>
/// <param name="pgos_params">Request params.</param>
public void GetStoreCategories(GetStoreCategoriesParams pgos_params, EconomyDelegate3 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | GetStoreCategoriesParams | Request params. |
| callback | EconomyDelegate3 |
Return: void
CreateStoreOrder
Create an order before purchase the specified store item in the store. After committing the order, the PGOS virtual server events event_item_granted/event_currency_changed will be triggered.
/// <summary>
/// Create an order before purchase the specified store item in the store.
/// After committing the order, the PGOS virtual server events `event_item_granted`/`event_currency_changed` will be triggered.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void CreateStoreOrder(CreateStoreOrderParams pgos_params, EconomyDelegate4 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | CreateStoreOrderParams | Request params. |
| callback | EconomyDelegate4 |
Return: void
CommitStoreOrder
After committing the order, the payment will be deducted and the items will be dispatched. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered. The event_custom_data filled in the parameter CreateStoreOrderParams will be passed to these events.
/// <summary>
/// After committing the order, the payment will be deducted and the items will be dispatched.
/// The PGOS virtual server events `event_item_granted`/`event_currency_changed` will be triggered.
/// The `event_custom_data` filled in the parameter `CreateStoreOrderParams` will be passed to these events.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void CommitStoreOrder(CommitStoreOrderParams pgos_params, EconomyDelegate5 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | CommitStoreOrderParams | Request params. |
| callback | EconomyDelegate5 |
Return: void
QueryStoreOrder
Query order status.
/// <summary>Query order status.</summary>
/// <param name="pgos_params">Request params.</param>
public void QueryStoreOrder(QueryStoreOrderParams pgos_params, EconomyDelegate6 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | QueryStoreOrderParams | Request params. |
| callback | EconomyDelegate6 |
Return: void
GetInventory
Get all item instances in the player's inventory.
/// <summary>Get all item instances in the player's inventory.</summary>
public void GetInventory(EconomyDelegate7 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | EconomyDelegate7 |
Return: void
GetInventoryWithFilter
Get all item instances in the player's inventory.
/// <summary>Get all item instances in the player's inventory.</summary>
/// <param name="pgos_params">Request params.</param>
public void GetInventoryWithFilter(GetInventoryWithFilterParams pgos_params, EconomyDelegate7 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | GetInventoryWithFilterParams | Request params. |
| callback | EconomyDelegate7 |
Return: void
ConsumeInstance
Consume the specified item instance in the player's inventory. The virtual server function bound to the consumer action will be called.
/// <summary>
/// Consume the specified item instance in the player's inventory.
/// The virtual server function bound to the consumer action will be called.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void ConsumeInstance(ConsumeInstanceParams pgos_params, EconomyDelegate8 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | ConsumeInstanceParams | Request params. |
| callback | EconomyDelegate8 |
Return: void
OpenContainerInstance
Open the specified container instance in the player's inventory. The PGOS virtual server events event_item_revoked and event_item_granted/event_currency_changed will be triggered.
/// <summary>
/// Open the specified container instance in the player's inventory.
/// The PGOS virtual server events `event_item_revoked` and `event_item_granted`/`event_currency_changed` will be triggered.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void OpenContainerInstance(OpenContainerInstanceParams pgos_params, EconomyDelegate9 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | OpenContainerInstanceParams | Request params. |
| callback | EconomyDelegate9 |
Return: void
RevokeInstance
Revoke the specified item instance in the player's inventory. The PGOS virtual server event event_item_revoked will be triggered.
/// <summary>
/// Revoke the specified item instance in the player's inventory.
/// The PGOS virtual server event `event_item_revoked` will be triggered.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void RevokeInstance(RevokeInstanceParams pgos_params, EconomyDelegate10 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | RevokeInstanceParams | Request params. |
| callback | EconomyDelegate10 |
Return: void
SetInstanceTags
Update the tags data of the specified item instance in the player's inventory. Instance tags can have up to 32 keys, with each key limited to 128 bytes and each value limited to 1024 bytes(in a narrow-character string).
/// <summary>
/// Update the `tags` data of the specified item instance in the player's inventory.
/// Instance `tags` can have up to 32 keys, with each key limited to 128 bytes and each value limited to 1024 bytes(in a narrow-character string).
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void SetInstanceTags(SetInstanceTagsParams pgos_params, EconomyDelegate11 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SetInstanceTagsParams | Request params. |
| callback | EconomyDelegate11 |
Return: void
CheckBeforePlatformPurchase
Check before purchasing items on 3rd-party platforms. Used to check situations where items cannot be purchased due to unique items, mapping configuration, etc.
/// <summary>Check before purchasing items on 3rd-party platforms. Used to check situations where items cannot be purchased due to unique items, mapping configuration, etc.</summary>
/// <param name="pgos_params">Request params.</param>
public void CheckBeforePlatformPurchase(CheckBeforePlatformPurchaseParams pgos_params, EconomyDelegate12 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | CheckBeforePlatformPurchaseParams | Request params. |
| callback | EconomyDelegate12 |
Return: void
SyncPlayerPlatformInventory
Synchronize the 3rd-party platform's inventory to PGOS. It is recommended to call it once after logging in to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered.
Deprecated, use SyncSteamPlayerInventory/SyncXboxPlayerInventory instead.
/// <summary>
/// Synchronize the 3rd-party platform's inventory to PGOS.
/// It is recommended to call it once after logging in to PGOS.
/// The PGOS virtual server events `event_item_granted`/`event_currency_changed` will be triggered.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void SyncPlayerPlatformInventory(SyncPlayerPlatformInventoryParams pgos_params, EconomyDelegate13 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SyncPlayerPlatformInventoryParams | Request params. |
| callback | EconomyDelegate13 |
Return: void
SyncSteamPlayerInventory
Synchronize the Steam platform's inventory to PGOS. It is recommended to call it once after logging in to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered.
/// <summary>
/// Synchronize the Steam platform's inventory to PGOS.
/// It is recommended to call it once after logging in to PGOS.
/// The PGOS virtual server events `event_item_granted`/`event_currency_changed` will be triggered.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void SyncSteamPlayerInventory(SyncSteamPlayerInventoryParams pgos_params, EconomyDelegate14 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SyncSteamPlayerInventoryParams | Request params. |
| callback | EconomyDelegate14 |
Return: void
SyncSteamPurchase
Synchronize item instances purchased by players from Steam to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered.
/// <summary>
/// Synchronize item instances purchased by players from Steam to PGOS.
/// The PGOS virtual server events `event_item_granted`/`event_currency_changed` will be triggered.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void SyncSteamPurchase(SyncSteamPurchaseParams pgos_params, EconomyDelegate14 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SyncSteamPurchaseParams | Request params. |
| callback | EconomyDelegate14 |
Return: void
SyncXboxPlayerInventory
Synchronize the Xbox platform's inventory to PGOS. It is recommended to call it once after logging in to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered.
/// <summary>
/// Synchronize the Xbox platform's inventory to PGOS.
/// It is recommended to call it once after logging in to PGOS.
/// The PGOS virtual server events `event_item_granted`/`event_currency_changed` will be triggered.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void SyncXboxPlayerInventory(SyncXboxPlayerInventoryParams pgos_params, EconomyDelegate15 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SyncXboxPlayerInventoryParams | Request params. |
| callback | EconomyDelegate15 |
Return: void
SyncXboxPurchase
Synchronize item instances purchased by players from Xbox to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered.
/// <summary>
/// Synchronize item instances purchased by players from Xbox to PGOS.
/// The PGOS virtual server events `event_item_granted`/`event_currency_changed` will be triggered.
/// </summary>
/// <param name="pgos_params">Request params.</param>
public void SyncXboxPurchase(SyncXboxPurchaseParams pgos_params, EconomyDelegate15 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SyncXboxPurchaseParams | Request params. |
| callback | EconomyDelegate15 |
Return: void
Event Details
OnInventoryGranted
The event will be triggered when new item instances are granted to player's inventory.
/// <summary>The event will be triggered when new item instances are granted to player's inventory.</summary>
public event EconomyDelegate16 OnInventoryGranted;
Type Reference:
OnBalanceUpdated
The event will be triggered when any currency amount changed.
/// <summary>The event will be triggered when any currency amount changed.</summary>
public event EconomyDelegate17 OnBalanceUpdated;
Type Reference:
All Delegates
public delegate void EconomyDelegate0(PgosResult a0, GetBalancesResult a1);
public delegate void EconomyDelegate1(PgosResult a0, Store a1);
public delegate void EconomyDelegate2(PgosResult a0, GetStoreBriefsResult a1);
public delegate void EconomyDelegate3(PgosResult a0, GetStoreCategoriesResult a1);
public delegate void EconomyDelegate4(PgosResult a0, CreateStoreOrderResult a1);
public delegate void EconomyDelegate5(PgosResult a0, CommitStoreOrderResult a1);
public delegate void EconomyDelegate6(PgosResult a0, QueryStoreOrderResult a1);
public delegate void EconomyDelegate7(PgosResult a0, ItemInstPack a1);
public delegate void EconomyDelegate8(PgosResult a0, ConsumeInstanceResult a1);
public delegate void EconomyDelegate9(PgosResult a0, OpenContainerResult a1);
public delegate void EconomyDelegate10(PgosResult a0, InstanceOperationResult a1);
public delegate void EconomyDelegate11(PgosResult a0, SetInstanceTagsResult a1);
public delegate void EconomyDelegate12(PgosResult a0);
public delegate void EconomyDelegate13(PgosResult a0, SyncPlayerPlatformInventoryResult a1);
public delegate void EconomyDelegate14(PgosResult a0, SyncSteamPurchaseResult a1);
public delegate void EconomyDelegate15(PgosResult a0, SyncXboxPurchaseResult a1);
public delegate void EconomyDelegate16(InventoryGrantedEvt a0);
public delegate void EconomyDelegate17(BalanceUpdatedEvt a0);
Type Reference:
- PgosResult
- GetBalancesResult
- Store
- GetStoreBriefsResult
- GetStoreCategoriesResult
- CreateStoreOrderResult
- CommitStoreOrderResult
- QueryStoreOrderResult
- ItemInstPack
- ConsumeInstanceResult
- OpenContainerResult
- InstanceOperationResult
- SetInstanceTagsResult
- SyncPlayerPlatformInventoryResult
- SyncSteamPurchaseResult
- SyncXboxPurchaseResult
- InventoryGrantedEvt
- BalanceUpdatedEvt