フレキシブル価格設定バンドルと統合する
Overview
The flexible pricing bundle in AccelByte Gaming Services (AGS) enables you to provide reasonable pricing options for players in your game who already own some items in the bundle. This also helps you offer more consistent discounting experience as pricing will be in-sync when contents of a bundle go on sale.
As demonstrated in the below image, the final bundle price is calculated by the following factors: player already owns an item in the bundle, item has a discount, and bundle has a discount.
Integrate with game client
This section covers how to integrate the flexible pricing bundle with your game client.
Login
Add your AGS Admin Portal login credentials to allow your game client to call the API endpoints for the flexible pricing bundle.
- AGS OSS for Unreal Engine
- Unreal Engine SDK
- Unity
- Go Extend SDK
Before you start, ensure that you have the correct configuration and have integrated your game with OSS. For more information, see AGS OSS for Unreal Engine.
IOnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get(ACCELBYTE_SUBSYSTEM);
FOnlineIdentityAccelBytePtr IdentityInterface = StaticCastSharedPtr<FOnlineIdentityAccelByte>(OnlineSubsystem->GetIdentityInterface());
if (!IdentityInterface.IsValid())
{
return;
}
const int32 LocalUserNum = 0;
auto AccelByteLoginCompletehandle = IdentityInterface->AddAccelByteOnLoginCompleteDelegate_Handle(LocalUserNum
, FAccelByteOnLoginCompleteDelegate::CreateLambda(
[this]
(int32 LoggedInLocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId,
const FOnlineErrorAccelByte& Error)
{
UE_LOG(LogTemp, Log, TEXT("Get AccelByteOnLoginComplete: LocalUserNum=%d"), LoggedInLocalUserNum);
})
);
const EAccelByteLoginType Type = EAccelByteLoginType::AccelByte;
const FString ID = TEXT("username");
const FString Password = TEXT("password");
IdentityInterface->Login(LocalUserNum, FOnlineAccelByteAccountCredentials{ Type , ID, Password });
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
const FString Username = TEXT("username");
const FString Password = TEXT("password");
ApiClient->User.LoginWithUsernameV3(Username, Password, FVoidHandler::CreateLambda([&]()
{
UE_LOG(LogTemp, Log, TEXT(" Success"));
bDeviceLoginSuccessful = true;
}), FOAuthErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage, const FErrorOAuthInfo& ErrorObject)
{
UE_LOG(LogTemp, Error, TEXT(" Error. Code: %d, Reason: %s"), ErrorCode, *ErrorMessage);
});
var user = AccelByteSDK.GetClientRegistry().GetApi().GetUser();
string emailAddress = "emailAddress";
string password = "password";
user.LoginWithUsernameV3(emailAddress, password, (Result<TokenData, OAuthError> result) =>
{
if (result.IsError)
{
// Your logic to handle errors in LoginWithUsernameV3
// ...
Debug.Log($"Error. Code: {result.Error.error} Reason: {result.Error.error_description}");
return;
}
// Your logic to run after LoginWithUsernameV3 is successful
});
configRepo = *auth.DefaultConfigRepositoryImpl()
tokenRepo = *auth.DefaultTokenRepositoryImpl()
oAuth20Service = &iam.OAuth20Service{
Client: factory.NewIamClient(&configRepo),
ConfigRepository: &configRepo,
TokenRepository: &tokenRepo,
}
email := "emailaddress"
password := "password"
err := oAuth20Service.LoginUser(email, password)
Get flexible pricing bundle
To get flexible pricing bundles, make sure you have already created them in Admin Portal. You can check the boolean field "Flexible" from the response to determine whether it is a flexible pricing bundle. To create a flexible pricing bundle, see Create flexible pricing bundle.
- AGS OSS for Unreal Engine
- Unreal Engine SDK
- Unity
- Go Extend SDK
Before you start, ensure that you have the correct configuration and have integrated your game with OSS. For more information, see AGS OSS for Unreal Engine.
const FOnlineStoreV2AccelBytePtr OnlineStoreV2AccelByte = StaticCastSharedPtr<FOnlineStoreV2AccelByte>(StoreInterface);
const FOnlinePurchaseAccelBytePtr OnlinePurchaseAccelByte = StaticCastSharedPtr<FOnlinePurchaseAccelByte>(PurchaseInterface);
// GetItemsByCriteria to get flexible bundle item
FAccelByteModelsItemPagingSlicedResult ItemPagingSlicedResult{};
OnlineStoreV2AccelByte->AddOnGetItemsByCriteriaCompleteDelegate_Handle(FOnGetItemsByCriteriaCompleteDelegate::CreateLambda(
[this, &ItemPagingSlicedResult]
(bool bWasSuccessful, const FAccelByteModelsItemPagingSlicedResult& Value, const FOnlineError& Error) {
if (bWasSuccessful)
{
ItemPagingSlicedResult = Value;
}
}));
const FString Region = TEXT("US");
FAccelByteModelsItemCriteria ItemCriteria;
ItemCriteria.Language = TEXT("en");
ItemCriteria.Region = Region;
ItemCriteria.ItemType = EAccelByteItemType::BUNDLE;
ItemCriteria.CategoryPath = ECommerceTestFlexibleBundleItemCategoryPath;
auto UserId = IdentityInterface->GetUniquePlayerId(LocalUserNum).Get();
OnlineStoreV2AccelByte->GetItemsByCriteria(*UserId, ItemCriteria);
FString ItemId = ItemPagingSlicedResult.Data[0].ItemId;
FAccelByteModelsItemInfo Item;
FAccelByteModelsItemCriteria ItemCriteria;
ItemCriteria.Language = TEXT("en");
ItemCriteria.Region = Region;
ItemCriteria.ItemType = EAccelByteItemType::BUNDLE;
ItemCriteria.CategoryPath = TEXT("/flexibleBundle");
UE_LOG(LogTemp, Log, TEXT("GetItemsByCriteria"));
ApiClient->Item.GetItemsByCriteria(ItemCriteria, 0, 20, THandler<FAccelByteModelsItemPagingSlicedResult>::CreateLambda([&]
(const FAccelByteModelsItemPagingSlicedResult& Result)
{
UE_LOG(LogTemp, Log, TEXT(" ChildFound: %d"), Result.Data.Num());
for (int i = 0; i < Result.Data.Num(); i++)
{
if (Result.Data[i].Flexible)
{
UE_LOG(LogTemp, Log, TEXT(" Found"));
Item = Result.Data[i];
break;
}
}
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
UE_LOG(LogTemp, Error, TEXT("Error. Code: %d, Reason: %s"), ErrorCode, *ErrorMessage)
});
var items = AccelByteSDK.GetClientRegistry().GetApi().GetItems();
var itemCriteria = new ItemCriteria()
{
language = "yourStoreLanguage",
region = "yourStoreRegion",
itemType = ItemType.BUNDLE,
categoryPath = "/yourCategoryPath"
};
ItemInfo itemInfo;
items.GetItemsByCriteria(itemCriteria, result =>
{
if (result.IsError)
{
// Your logic to handle errors in GetItemsByCriteria
// ...
Debug.Log($"Error. Code: {result.Error.Code} Reason: {result.Error.Message}");
return;
}
Debug.Log($"ChildFound: {result.Value.data.Length}");
for (int i = 0; i < result.Value.data.Length; i++)
{
if (result.Value.data[i].Flexible)
{
Debug.Log("Found");
itemInfo = result.Value.data[i];
break;
}
}
});
itemService := &platform.ItemService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
namespace := "mygame"
categoryPath := "/mycategorypath"
itemType := "BUNDLE"
language := "mylanguage"
region := "myregion"
input := &item.PublicQueryItemsParams{
Namespace: namespace,
CategoryPath: &categoryPath,
ItemType: &itemType,
Language: &language,
Region: ®ion,
}
result, err := itemService.PublicQueryItemsShort(input)
var itemInfo *platformclientmodels.ItemInfo
if result != nil && result.Data != nil {
for _, s := range result.Data {
if (s.Flexible) {
itemInfo = s // Found
break
}
}
}
Get estimated price
As the price can be varied by who is buying a flexible pricing bundle and when, the game client needs to call the GetEstimatedPrice
endpoint to get the latest pricing for players.
- AGS OSS for Unreal Engine
- Unreal Engine SDK
- Unity
- Go Extend SDK
Before you start, ensure that you have the correct configuration and have integrated your game with OSS. For more information, see AGS OSS for Unreal Engine.
// GetEstimatedPrice to get the proper price when creating order
bool bGettingEstimatedPriceDone = false;
bool bGettingEstimatedPriceSuccess = false;
TArray<FAccelByteModelsEstimatedPrices> EstimatedPrices{};
OnlineStoreV2AccelByte->AddOnGetEstimatedPriceCompleteDelegate_Handle(FOnGetEstimatedPriceCompleteDelegate::CreateLambda(
[this, &EstimatedPrices]
(bool bWasSuccessful, const TArray<FAccelByteModelsEstimatedPrices>& Value, const FOnlineErrorAccelByte& Error) {
if (bWasSuccessful)
{
EstimatedPrices = Value;
}
}));
auto UserId = IdentityInterface->GetUniquePlayerId(LocalUserNum).Get();
OnlineStoreV2AccelByte->GetEstimatedPrice(*UserId, {ItemId}, Region);
TArray<FAccelByteModelsEstimatedPrices> EstimatedItems{};
UE_LOG(LogTemp, Log, TEXT("GetItemsByCriteria"));
ApiClient->Item.GetEstimatedPrice({ItemId}, Region,
THandler<TArray<FAccelByteModelsEstimatedPrices>>::CreateLambda([&EstimatedItems]
(const TArray<FAccelByteModelsEstimatedPrices>& Result)
{
EstimatedItems = Result;
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
UE_LOG(LogTemp, Error, TEXT("Error. Code: %d, Reason: %s"), ErrorCode, *ErrorMessage)
});
var items = AccelByteSDK.GetClientRegistry().GetApi().GetItems();
string[] itemIds = new string[]
{
"yourItemId1",
"yourItemId2"
};
string region = "yourStoreRegion";
EstimatedPricesInfo[] estimatedItems;
items.GetEstimatedPrice(itemIds, region, result =>
{
if (result.IsError)
{
// Your logic to handle errors in GetEstimatedPrice
// ...
Debug.Log($"Error. Code: {result.Error.Code} Reason: {result.Error.Message}");
return;
}
estimatedItems = result.Value;
});
itemService := &platform.ItemService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
namespace := "mygame"
itemIds := "itemId1,itemId2,itemId3"
userId := "myuserid"
input := &item.GetEstimatedPriceParams{
Namespace: namespace,
ItemIds: itemIds,
UserID: userId,
}
result, err := itemService.GetEstimatedPriceShort(input)
Create order
Ensure that you use th estimated price when placing an order for a flexible pricing bundle.
- AGS OSS for Unreal Engine
- Unreal Engine SDK
- Unity
- Go Extend SDK
Before you start, ensure that you have the correct configuration and have integrated your game with OSS. For more information, see AGS OSS for Unreal Engine.
// Create Order to enabling OrderBundleItemInfos
const FString CurrencyCode = EstimatedPrices[0].EstimatedPrices[0].CurrencyCode;
const int32 DiscountedPrice = EstimatedPrices[0].EstimatedPrices[0].DiscountedPrice;
const int32 Price = EstimatedPrices[0].EstimatedPrices[0].Price;
FString OrderNo{};
constexpr int32 Quantity = 1;
FAccelByteModelsOrderCreate OrderCreate;
OrderCreate.CurrencyCode = CurrencyCode;
OrderCreate.DiscountedPrice = DiscountedPrice * Quantity;
OrderCreate.Price = Price * Quantity;
OrderCreate.Quantity = Quantity;
OrderCreate.ReturnUrl = TEXT("https://sdk.example.com");
OrderCreate.ItemId = ItemId;
OrderCreate.Region = Region;
OrderCreate.Language = TEXT("en");
bool bCreatingOrderDone = false;
bool bCreatingOrderSuccess = false;
FAccelByteModelsOrderInfo OrderInfo{};
OnlinePurchaseAccelByte->AddOnCreateNewOrderCompleteDelegate_Handle(FOnCreateNewOrderCompleteDelegate::CreateLambda(
[this, &OrderInfo]
(bool bWasSuccessful, FAccelByteModelsOrderInfo Value, const FOnlineErrorAccelByte& Error) {
if (bWasSuccessful)
{
OrderInfo = Value;
}
}));
auto UserId = IdentityInterface->GetUniquePlayerId(LocalUserNum).Get();
OnlinePurchaseAccelByte->CreateNewOrder(*UserId, OrderCreate);
FString OrderNo{};
constexpr int32 Quantity = 1;
FAccelByteModelsOrderCreate OrderCreate;
OrderCreate.CurrencyCode = EstimatedItems[0].EstimatedPrices[0].CurrencyCode;
OrderCreate.DiscountedPrice = EstimatedItems[0].EstimatedPrices[0].DiscountedPrice * Quantity;
OrderCreate.Price = EstimatedItems[0].EstimatedPrices[0].Price * Quantity;
OrderCreate.Quantity = 1;
OrderCreate.ReturnUrl = TEXT("https://sdk.example.com");
OrderCreate.ItemId = Item.ItemId;
OrderCreate.Region = TEXT("US");
OrderCreate.Language = TEXT("en");
UE_LOG(LogTemp, Log, TEXT("CreateNewOrder"));
ApiClient->Order.CreateNewOrder(OrderCreate
, THandler<FAccelByteModelsOrderInfo>::CreateLambda(
[&](const FAccelByteModelsOrderInfo& Result)
{
UE_LOG(LogTemp, Log, TEXT(" Success"));
OrderNo = Result.OrderNo;
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
UE_LOG(LogTemp, Error, TEXT("Error. Code: %d, Reason: %s"), ErrorCode, *ErrorMessage)
});
var orders = AccelByteSDK.GetClientRegistry().GetApi().GetOrders();
string language = "yourStoreLanguage";
string region = "yourStoreRegion";
int quantity = 1;
var itemToOrder = itemInfo; // Retrieved from items.GetItemsByCriteria
var storeItemData = estimatedItems[0]; // Retrieved from items.GetEstimatedPrice
string orderNumber;
var orderRequest = new OrderRequest()
{
currencyCode = storeItemData.EstimatedPrices[0].CurrencyCode,
discountedPrice = storeItemData.EstimatedPrices[0].DiscountedPrice * quantity,
price = storeItemData.EstimatedPrices[0].Price * quantity,
quantity = quantity,
itemId = itemToOrder.itemId,
language = language,
region = region
};
orders.CreateOrder(orderRequest, result =>
{
if (result.IsError)
{
// Your logic to handle errors in CreateOrder
// ...
Debug.Log($"Error. Code: {result.Error.Code} Reason: {result.Error.Message}");
return;
}
orderNumber = result.Value.orderNo;
});
// itemInfo retrieved from PublicQueryItems
// estimatedItems retrieved from GetEstimatedPrice
orderService := &platform.OrderService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
namespace := "mygame"
userId := "myuserid"
quantity := int32(1)
currencyCode := estimatedItems.EstimatedPrices[0].CurrencyCode
discountedPrice := *estimatedItems.EstimatedPrices[0].DiscountedPrice * quantity;
price := *estimatedItems.EstimatedPrices[0].Price * quantity;
itemId := itemInfo.Data[0].ItemID
body := platformclientmodels.OrderCreate {
CurrencyCode: currencyCode,
DiscountedPrice: &discountedPrice,
ItemID: itemId,
Price: price,
Quantity: &quantity,
ReturnURL: "https://example.com",
Region: "US",
Language: "en",
}
input := &order.PublicCreateUserOrderParams{
Body: &body,
Namespace: namespace,
UserID: userId,
}
result, err := orderService.PublicCreateUserOrderShort(input)
Query order
Use the QueryUserOrders
endpoint to retrieve information on the bundle order.
- AGS OSS for Unreal Engine
- Unreal Engine SDK
- Unity
- Go Extend SDK
Before you start, ensure that you have the correct configuration and have integrated your game with OSS. For more information, see AGS OSS for Unreal Engine.
// QueryUserOrders to check OrderBundleItemInfos exist
bool bGettingUserOrdersDone = false;
bool bGettingUserOrdersSuccess = false;
FAccelByteModelsPagedOrderInfo PagedOrderInfo{};
OnlinePurchaseAccelByte->AddOnQueryUserOrdersCompleteDelegate_Handle(FOnQueryUserOrdersCompleteDelegate::CreateLambda(
[this, &PagedOrderInfo]
(bool bWasSuccessful, const FAccelByteModelsPagedOrderInfo& Value, const FOnlineErrorAccelByte& Error) {
if (bWasSuccessful)
{
PagedOrderInfo = Value;
}
}));
FAccelByteModelsUserOrdersRequest UserOrdersRequest{};
UserOrdersRequest.ItemId = ItemId;
auto UserId = IdentityInterface->GetUniquePlayerId(LocalUserNum).Get();
OnlinePurchaseAccelByte->QueryUserOrders(*UserId, UserOrdersRequest);
You can find the bundle order information in the OrderBundleItemInfos
variable.
auto BundleInfo = PagedOrderInfo.Data[0].OrderBundleItemInfos;
UE_LOG(LogTemp, Log, TEXT("GetUserOrder"));
FAccelByteModelsOrderInfo OrderInfo{};
ApiClient->Order.GetUserOrder(OrderNo
, THandler<FAccelByteModelsOrderInfo>::CreateLambda(
[&](const FAccelByteModelsOrderInfo& Result)
{
UE_LOG(LogTemp, Log, TEXT(" Success"));
OrderInfo = Result;
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
UE_LOG(LogTemp, Error, TEXT("Error. Code: %d, Reason: %s"), ErrorCode, *ErrorMessage)
});
You can find the bundle order information in the OrderBundleItemInfos
variable.
auto BundleInfo = OrderInfo.OrderBundleItemInfos;
var orders = AccelByteSDK.GetClientRegistry().GetApi().GetOrders();
OrderInfo orderInfo;
// orderNumber is retrieved from orders.CreateOrder
orders.GetUserOrder(orderNumber, result =>
{
if (result.IsError)
{
// Your logic to handle errors in GetEstimatedPrice
// ...
Debug.Log($"Error. Code: {result.Error.Code} Reason: {result.Error.Message}");
return;
}
orderInfo = result.Value;
});
You can find the bundle order information in the OrderBundleItemInfos
variable.
var bundleInfo = orderInfo.OrderBundleItemInfos;
orderService := &platform.OrderService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
namespace := "mygame"
orderNo := "myorderno"
userId := "myuserid"
input := &order.GetUserOrderParams{
Namespace: namespace,
OrderNo: orderNo,
UserID: userId,
}
result, err := orderService.GetUserOrderShort(input)
Auto-calculate estimated price
In order to simplify getting flexible bundle items with an estimated price, set the autoCalcEstimatedPrice
parameter to true
when getting the item.
Get item by ID
- Unity
- Go Extend SDK
string itemId = "YourItemId";
string storeLanguage = "en-US";
string storeRegion = "US";
bool autoCalcEstimatedPrice = true;
PopulatedItemInfo itemInfo;
int itemPrice;
Items items = AccelByteSDK.GetClientRegistry().GetApi().GetItems();
items.GetItemById(itemId, storeRegion, storeLanguage, autoCalcEstimatedPrice, result =>
{
if (result.IsError)
{
// Your logic to handle errors in GetItemById
// ...
Debug.Log($"Error GetItemById, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
itemInfo = result.Value;
itemPrice = itemInfo.regionData[0].price;
});
itemService := &platform.ItemService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
itemId := "myitemid"
namespace := "mygame"
autoCalcEstimatedPrice := true
language := "mylanguage"
region := "myregion"
input := &item.PublicGetItemParams{
ItemID: itemId,
Namespace: namespace,
AutoCalcEstimatedPrice: &autoCalcEstimatedPrice,
Language: &language,
Region: ®ion,
}
result, err := itemService.PublicGetItemShort(input)
Get item by SKU
- Unity
- Go Extend SDK
string itemSku = "ItemSku";
string itemLanguage = "en-US";
string itemRegion = "US";
bool autoCalcEstimatedPrice = true;
ItemInfo itemInfo;
int itemPrice;
Items items = AccelByteSDK.GetClientRegistry().GetApi().GetItems();
items.GetItemBySku(itemSku, itemLanguage, itemRegion, autoCalcEstimatedPrice, result =>
{
if (result.IsError)
{
// Your logic to handle errors in GetItemBySku
// ...
Debug.Log($"Error GetItemBySku, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
itemInfo = result.Value;
itemPrice = itemInfo.regionData[0].price;
});
itemService := &platform.ItemService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
namespace := "mygame"
sku := "myitemsku"
autoCalcEstimatedPrice := true
language := "mylanguage"
region := "myregion"
storeId := "mystoreid"
input := &item.PublicGetItemBySkuParams{
Namespace: namespace,
AutoCalcEstimatedPrice: &autoCalcEstimatedPrice,
Language: &language,
Region: ®ion,
StoreID: &storeId,
Sku: sku,
}
result, err := itemService.PublicGetItemBySkuShort(input)
Get local items by bulk
- Unity
- Go Extend SDK
string[] itemIds = { "YourItemId1", "YourItemId2" };
string storeLanguage = "en-US";
string storeRegion = "US";
bool autoCalcEstimatedPrice = true;
ItemInfo[] itemsInfo;
Items items = AccelByteSDK.GetClientRegistry().GetApi().GetItems();
items.BulkGetLocaleItems(itemIds, storeLanguage, storeRegion, autoCalcEstimatedPrice, result =>
{
if (result.IsError)
{
// Your logic to handle errors in BulkGetLocaleItems
// ...
Debug.Log($"Error BulkGetLocaleItems, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
itemsInfo = result.Value;
});
itemService := &platform.ItemService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
namespace := "mygame"
itemIds := "item1,item2,item3"
autoCalcEstimatedPrice := true
language := "mylanguage"
region := "myregion"
input := &item.PublicBulkGetItemsParams{
Namespace: namespace,
AutoCalcEstimatedPrice: &autoCalcEstimatedPrice,
Language: &language,
Region: ®ion,
ItemIds: itemIds,
}
result, err := itemService.PublicBulkGetItemsShort(input)
Search item
- Unity
- Go Extend SDK
string itemKeyword = "ItemKeyword";
string itemRegion = "US";
int offset = 0;
int limit = 5;
bool autoCalcEstimatedPrice = true;
ItemInfo[] itemsInfo;
Items items = AccelByteSDK.GetClientRegistry().GetApi().GetItems();
items.SearchItem(storeLanguage, itemKeyword, offset, limit, itemRegion, autoCalcEstimatedPrice, result =>
{
if (result.IsError)
{
// Your logic to handle errors in SearchItem
// ...
Debug.Log($"Error SearchItem, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
itemsInfo = result.Value.data;
});
itemService := &platform.ItemService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
namespace := "mygame"
keyword := "mykeyword"
language := "mylanguage"
autoCalcEstimatedPrice := true
limit := int32(5)
offset := int32(0)
region := "myregion"
input := &item.PublicSearchItemsParams{
Namespace: namespace,
AutoCalcEstimatedPrice: &autoCalcEstimatedPrice,
Limit: &limit,
Offset: &offset,
Region: ®ion,
Keyword: keyword,
Language: language,
}
result, err := itemService.PublicSearchItemsShort(input)
List active section contents
- Unity
- Go Extend SDK
string storeId = "YourStoreIdFromAdminPortal";
string viewId = "YourViewId";
string storeLanguage = "en-US";
string storeRegion = "US";
bool autoCalcEstimatedPrice = true;
SectionInfo[] sectionsInfo;
StoreDisplay storeDisplay = AccelByteSDK.GetClientRegistry().GetApi().GetStoreDisplayService();
storeDisplay.ListActiveSectionContents(storeId
, viewId
, storeRegion
, storeLanguage
, autoCalcEstimatedPrice
, result =>
{
if (result.IsError)
{
// Your logic to handle errors in ListActiveSectionContents
// ...
Debug.Log($"Error ListActiveSectionContents, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
sectionsInfo = result.Value;
// Your logic to run after ListActiveSectionContents is successful
});
sectionService := &platform.SectionService{
Client: factory.NewPlatformClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
namespace := "mygame"
userId := "myuserid"
autoCalcEstimatedPrice := true
language := "mylanguage"
region := "myregion"
storeId := "mystoreid"
viewId := "myviewid"
input := §ion.PublicListActiveSectionsParams{
Namespace: namespace,
UserID: userId,
AutoCalcEstimatedPrice: &autoCalcEstimatedPrice,
Language: &language,
Region: ®ion,
StoreID: &storeId,
ViewID: &viewId,
}
result, err := sectionService.PublicListActiveSectionsShort(input)