UXsollaInventorySubsystem
Inherits from UGameInstanceSubsystem
Public Functions
| Name | |
|---|---|
| UXsollaInventorySubsystem () | |
| virtual void | Initialize (FSubsystemCollectionBase & Collection) override |
| virtual void | Deinitialize () override |
| void | Initialize
(const FString & InProjectId) Initialize the controller with provided Project ID (use to override project settings) |
| void | GetInventory
(const FString & AuthToken, const EXsollaPublishingPlatform Platform, const FOnInventoryUpdate & SuccessCallback, const FOnError & ErrorCallback, const int Limit =50, const int Offset =0) Returns a list of virtual items from the user’s inventory according to pagination settings. |
| void | GetVirtualCurrencyBalance
(const FString & AuthToken, const EXsollaPublishingPlatform Platform, const FOnCurrencyBalanceUpdate & SuccessCallback, const FOnError & ErrorCallback) Returns the current user’s balance of virtual currency. |
| void | GetTimeLimitedItems
(const FString & AuthToken, const EXsollaPublishingPlatform Platform, const FOnTimeLimitedItemsUpdate & SuccessCallback, const FOnError & ErrorCallback) Returns a list of time-limited items from the user’s inventory. |
| void | ConsumeInventoryItem
(const FString & AuthToken, const FString & ItemSKU, const int32 Quantity, const FString & InstanceID, const EXsollaPublishingPlatform Platform, const FOnInventoryRequestSuccess & SuccessCallback, const FOnError & ErrorCallback) Consumes an inventory item. |
| void | GetCouponRewards
(const FString & AuthToken, const FString & CouponCode, const FOnCouponRewardsUpdate & SuccessCallback, const FOnError & ErrorCallback) Returns a list of items that can be credited to the user when the coupon is redeemed. |
| void | RedeemCoupon
(const FString & AuthToken, const FString & CouponCode, const FOnCouponRedeemUpdate & SuccessCallback, const FOnError & ErrorCallback) Redeems the coupon code and delivers a reward to the user. |
| static bool | IsItemInInventory
(const FInventoryItemsData
& Inventory, const FString & ItemSKU, FInventoryItem
& FoundItem) Checks if the certain item is in the inventory. |
Protected Functions
| Name | |
|---|---|
| void | GetInventory_HttpRequestComplete (FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, const bool bSucceeded, FOnInventoryUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper) |
| void | GetVirtualCurrencyBalance_HttpRequestComplete (FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, const bool bSucceeded, FOnCurrencyBalanceUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper) |
| void | GetTimeLimitedItems_HttpRequestComplete (FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, const bool bSucceeded, FOnTimeLimitedItemsUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper) |
| void | ConsumeInventoryItem_HttpRequestComplete (FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, const bool bSucceeded, FOnInventoryRequestSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper) |
| void | UpdateCouponRewards_HttpRequestComplete (FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, const bool bSucceeded, FOnCouponRewardsUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper) |
| void | RedeemCoupon_HttpRequestComplete (FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, const bool bSucceeded, FOnCouponRedeemUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper) |
Protected Attributes
| Name | |
|---|---|
| FString | ProjectID Cached Xsolla Store project id. |
Public Functions Documentation
function UXsollaInventorySubsystem
- C++
1UXsollaInventorySubsystem()
function Initialize
- C++
1virtual void Initialize(
2 FSubsystemCollectionBase & Collection
3) override
function Deinitialize
- C++
1virtual void Deinitialize() override
function Initialize
- C++
1void Initialize(
2 const FString & InProjectId
3)
Initialize the controller with provided Project ID (use to override project settings)
Parameters:
- InProjectId New Project ID value from Publisher Account. It can be found in Publisher Account next to the name of your project.
function GetInventory
- C++
1void GetInventory(
2 const FString & AuthToken,
3 const EXsollaPublishingPlatform Platform,
4 const FOnInventoryUpdate & SuccessCallback,
5 const FOnError & ErrorCallback,
6 const int Limit =50,
7 const int Offset =0
8)
Returns a list of virtual items from the user’s inventory according to pagination settings.
Parameters:
- AuthToken User authorization token obtained during authorization using Xsolla Login (more about authorization options ).
- Platform Publishing platform the user plays on.
Can be xsolla (default), playstation_network, xbox_live, pc_standalone, nintendo_shop, google_play, app_store_ios, android_standalone, ios_standalone, android_other, ios_other, or pc_other.
- SuccessCallback Called after purchased virtual items were successfully received.
- ErrorCallback Called after the request resulted with an error.
- Limit Limit for the number of elements on the page. The maximum number of elements on a page is 50.
- Offset Number of the element from which the list is generated (the count starts from 0).
For each virtual item, complete data is returned. Attention: The number of items returned in a single response is limited. The default and maximum value is 50 items per response. To get more data page by page, use Limit and Offset fields. More about the use cases
.
function GetVirtualCurrencyBalance
- C++
1void GetVirtualCurrencyBalance(
2 const FString & AuthToken,
3 const EXsollaPublishingPlatform Platform,
4 const FOnCurrencyBalanceUpdate & SuccessCallback,
5 const FOnError & ErrorCallback
6)
Returns the current user’s balance of virtual currency.
Parameters:
- AuthToken User authorization token obtained during authorization using Xsolla Login (more about authorization options ).
- Platform Publishing platform the user plays on.
Can be xsolla (default), playstation_network, xbox_live, pc_standalone, nintendo_shop, google_play, app_store_ios, android_standalone, ios_standalone, android_other, ios_other, or pc_other.
- SuccessCallback Called after virtual currency balance was successfully received.
- ErrorCallback Called after the request resulted with an error.
For each virtual currency, complete data is returned. More about the use cases .
function GetTimeLimitedItems
- C++
1void GetTimeLimitedItems(
2 const FString & AuthToken,
3 const EXsollaPublishingPlatform Platform,
4 const FOnTimeLimitedItemsUpdate & SuccessCallback,
5 const FOnError & ErrorCallback
6)
Returns a list of time-limited items from the user’s inventory.
Parameters:
- AuthToken User authorization token obtained during authorization using Xsolla Login (more about authorization options ).
- Platform Publishing platform the user plays on.
Can be xsolla (default), playstation_network, xbox_live, pc_standalone, nintendo_shop, google_play, app_store_ios, android_standalone, ios_standalone, android_other, ios_other, or pc_other.
- SuccessCallback Called after list of user time limited items was successfully received.
- ErrorCallback Called after the request resulted with an error.
For each item, complete data is returned. More about the use cases .
function ConsumeInventoryItem
- C++
1void ConsumeInventoryItem(
2 const FString & AuthToken,
3 const FString & ItemSKU,
4 const int32 Quantity,
5 const FString & InstanceID,
6 const EXsollaPublishingPlatform Platform,
7 const FOnInventoryRequestSuccess & SuccessCallback,
8 const FOnError & ErrorCallback
9)
Consumes an inventory item.
Parameters:
- AuthToken User authorization token obtained during authorization using Xsolla Login (more about authorization options ).
- ItemSKU Desired item SKU.
- Quantity Item quantity. If the item is uncountable, should be zero.
- InstanceID Instance item ID. If the item is countable, should be empty.
- Platform Publishing platform the user plays on.
Can be xsolla (default), playstation_network, xbox_live, pc_standalone, nintendo_shop, google_play, app_store_ios, android_standalone, ios_standalone, android_other, ios_other, or pc_other.
- SuccessCallback Called after successful inventory item consumption.
- ErrorCallback Called after the request resulted with an error.
Use for only for consumable virtual items. More about the use cases .
function GetCouponRewards
- C++
1void GetCouponRewards(
2 const FString & AuthToken,
3 const FString & CouponCode,
4 const FOnCouponRewardsUpdate & SuccessCallback,
5 const FOnError & ErrorCallback
6)
Returns a list of items that can be credited to the user when the coupon is redeemed.
Parameters:
- AuthToken User authorization token obtained during authorization using Xsolla Login (more about authorization options ).
- CouponCode Unique case sensitive code. Contains letters and numbers.
- SuccessCallback Called after receiving coupon rewards successfully.
- ErrorCallback Called after the request resulted with an error.
Can be used to let users choose one of many items as a bonus. The usual case is choosing a DRM if the coupon contains a game as a bonus. More about the use cases .
function RedeemCoupon
- C++
1void RedeemCoupon(
2 const FString & AuthToken,
3 const FString & CouponCode,
4 const FOnCouponRedeemUpdate & SuccessCallback,
5 const FOnError & ErrorCallback
6)
Redeems the coupon code and delivers a reward to the user.
Parameters:
- AuthToken User authorization token obtained during authorization using Xsolla Login (more about authorization options ).
- CouponCode Unique case sensitive code. Contains letters and numbers.
- SuccessCallback Called after successful coupon redemption.
- ErrorCallback Called after the request resulted with an error.
The reward is delivered in one of the following ways:
- to their inventory (virtual items, virtual currency packages, or bundles)
- via email (game keys)
- to the entitlement system (game keys) More about the use cases .
function IsItemInInventory
- C++
1static bool IsItemInInventory(
2 const FInventoryItemsData & Inventory,
3 const FString & ItemSKU,
4 FInventoryItem & FoundItem
5)
Checks if the certain item is in the inventory.
Protected Functions Documentation
function GetInventory_HttpRequestComplete
- C++
1void GetInventory_HttpRequestComplete(
2 FHttpRequestPtr HttpRequest,
3 FHttpResponsePtr HttpResponse,
4 const bool bSucceeded,
5 FOnInventoryUpdate SuccessCallback,
6 FErrorHandlersWrapper ErrorHandlersWrapper
7)
function GetVirtualCurrencyBalance_HttpRequestComplete
- C++
1void GetVirtualCurrencyBalance_HttpRequestComplete(
2 FHttpRequestPtr HttpRequest,
3 FHttpResponsePtr HttpResponse,
4 const bool bSucceeded,
5 FOnCurrencyBalanceUpdate SuccessCallback,
6 FErrorHandlersWrapper ErrorHandlersWrapper
7)
function GetTimeLimitedItems_HttpRequestComplete
- C++
1void GetTimeLimitedItems_HttpRequestComplete(
2 FHttpRequestPtr HttpRequest,
3 FHttpResponsePtr HttpResponse,
4 const bool bSucceeded,
5 FOnTimeLimitedItemsUpdate SuccessCallback,
6 FErrorHandlersWrapper ErrorHandlersWrapper
7)
function ConsumeInventoryItem_HttpRequestComplete
- C++
1void ConsumeInventoryItem_HttpRequestComplete(
2 FHttpRequestPtr HttpRequest,
3 FHttpResponsePtr HttpResponse,
4 const bool bSucceeded,
5 FOnInventoryRequestSuccess SuccessCallback,
6 FErrorHandlersWrapper ErrorHandlersWrapper
7)
function UpdateCouponRewards_HttpRequestComplete
- C++
1void UpdateCouponRewards_HttpRequestComplete(
2 FHttpRequestPtr HttpRequest,
3 FHttpResponsePtr HttpResponse,
4 const bool bSucceeded,
5 FOnCouponRewardsUpdate SuccessCallback,
6 FErrorHandlersWrapper ErrorHandlersWrapper
7)
function RedeemCoupon_HttpRequestComplete
- C++
1void RedeemCoupon_HttpRequestComplete(
2 FHttpRequestPtr HttpRequest,
3 FHttpResponsePtr HttpResponse,
4 const bool bSucceeded,
5 FOnCouponRedeemUpdate SuccessCallback,
6 FErrorHandlersWrapper ErrorHandlersWrapper
7)
Protected Attributes Documentation
variable ProjectID
FString ProjectID;
Cached Xsolla Store project id.
Found a typo or other text error? Select the text and press Ctrl+Enter.