Skip to main content

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

APIDescription
GetBalancesGet all balances of the player.
GetStoreGet the specified store defined on the portal.
GetStoreWithPlatformGet the specified store defined on the portal. This interface can get the value of 'platform_item_mapping'.
GetStoreBriefsGet brief information of specified stores.
GetStoreCategoriesGet the specified store categories defined on the portal.
CreateStoreOrderCreate 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.
CommitStoreOrderAfter 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.
QueryStoreOrderQuery order status.
GetInventoryGet all item instances in the player's inventory.
GetInventoryWithFilterGet all item instances in the player's inventory.
ConsumeInstanceConsume the specified item instance in the player's inventory. The virtual server function bound to the consumer action will be called.
OpenContainerInstanceOpen 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.
RevokeInstanceRevoke the specified item instance in the player's inventory. The PGOS virtual server event event_item_revoked will be triggered.
SetInstanceTagsUpdate 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).
CheckBeforePlatformPurchaseCheck before purchasing items on 3rd-party platforms. Used to check situations where items cannot be purchased due to unique items, mapping configuration, etc.
SyncPlayerPlatformInventorySynchronize 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.
SyncSteamPlayerInventorySynchronize 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.
SyncSteamPurchaseSynchronize item instances purchased by players from Steam to PGOS. The PGOS virtual server events event_item_granted/event_currency_changed will be triggered.
SyncXboxPlayerInventorySynchronize 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.
SyncXboxPurchaseSynchronize 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

EventDescription
OnInventoryGrantedThe event will be triggered when new item instances are granted to player's inventory.
OnBalanceUpdatedThe 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:

ParamTypeDescription
callbackEconomyDelegate0

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:

ParamTypeDescription
pgos_paramsGetStoreParamsRequest params.
callbackEconomyDelegate1

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:

ParamTypeDescription
pgos_paramsGetStoreWithPlatformParamsRequest params.
callbackEconomyDelegate1

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:

ParamTypeDescription
pgos_paramsGetStoreBriefsParamsRequest params.
callbackEconomyDelegate2

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:

ParamTypeDescription
pgos_paramsGetStoreCategoriesParamsRequest params.
callbackEconomyDelegate3

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:

ParamTypeDescription
pgos_paramsCreateStoreOrderParamsRequest params.
callbackEconomyDelegate4

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:

ParamTypeDescription
pgos_paramsCommitStoreOrderParamsRequest params.
callbackEconomyDelegate5

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:

ParamTypeDescription
pgos_paramsQueryStoreOrderParamsRequest params.
callbackEconomyDelegate6

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:

ParamTypeDescription
callbackEconomyDelegate7

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:

ParamTypeDescription
pgos_paramsGetInventoryWithFilterParamsRequest params.
callbackEconomyDelegate7

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:

ParamTypeDescription
pgos_paramsConsumeInstanceParamsRequest params.
callbackEconomyDelegate8

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:

ParamTypeDescription
pgos_paramsOpenContainerInstanceParamsRequest params.
callbackEconomyDelegate9

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:

ParamTypeDescription
pgos_paramsRevokeInstanceParamsRequest params.
callbackEconomyDelegate10

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:

ParamTypeDescription
pgos_paramsSetInstanceTagsParamsRequest params.
callbackEconomyDelegate11

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:

ParamTypeDescription
pgos_paramsCheckBeforePlatformPurchaseParamsRequest params.
callbackEconomyDelegate12

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:

ParamTypeDescription
pgos_paramsSyncPlayerPlatformInventoryParamsRequest params.
callbackEconomyDelegate13

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:

ParamTypeDescription
pgos_paramsSyncSteamPlayerInventoryParamsRequest params.
callbackEconomyDelegate14

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:

ParamTypeDescription
pgos_paramsSyncSteamPurchaseParamsRequest params.
callbackEconomyDelegate14

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:

ParamTypeDescription
pgos_paramsSyncXboxPlayerInventoryParamsRequest params.
callbackEconomyDelegate15

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:

ParamTypeDescription
pgos_paramsSyncXboxPurchaseParamsRequest params.
callbackEconomyDelegate15

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: