1. Call Shop Categories
The UMyStoveSDKObject::StoveSDKFetchShopCategories function retrieves store category information for the game. Category information includes the CategoryID (and ParentCategoryID, a value in which categorizes your in-game items (hierachial or vertical). (click here to find more amount cateogry ID)
FStoveResult UMyStoveSDKObject::StoveSDKFetchShopCategories()
{
FStoveResult ErrorResult = Super::StoveSDKFetchShopCategories(StatId, StatValue);
if(ErrorResult.Result == StovePCResult::STOVE_PC_NO_ERROR)
{
// handle success
}
return ErrorResult;
}
Plain Text
복사
When the UMyStoveSDKObject::StoveSDKFetchShopCategories function is successfully processed, the OnFetchShopCategories callback is called.
The FStoveShopCategory structure passed to the callback contains meta information about the store category.
•
FStoveShopCategory.CategoryId: CategoryID
•
FStoveShopCategory.ParentCategoryId: Parent CategoryID
•
FStoveShopCategory.DisplayNo: Category Order
•
FStoveShopCategory.Name: Category Name
•
FStoveShopCategory.Depth: Category Depth (1 for the highest category)
void UMyStoveSDKObject::OnFetchShopCategories(int Size, FStoveShopCategories* Categories)
{
/*Add the 'walkthrough' codes here.*/
OnLog("[OnFetchShopCategories]");
OnLog("ShopCategories size = %d ", Size);
for (int i = 0; i < Size; i++, Categories++)
{
OnLog(" -> Index: %d", i);
OnLog("---------------------------------------------- --------");
OnLog(" CategoryId : %s", *(Categories->CategoryId));
OnLog(" ParentCategoryId : %s", *(Categories->ParentCategoryId));
OnLog(" DisplayNo : %d", Categories->DisplayNo);
OnLog(" Name : %s", *(Categories->Name));
OnLog(" Depth : %d", Categories->Depth);
OnLog("---------------------------------------------- --------");
}
}
C++
복사
The OnError callback is called if an error occurs while running the UMyStoveSDKObejct::StoveSDKFetchShopProducts function. External errors can be checked through the ExternalError field of the FStoveError structure.
ExternalError | Description |
500 | Internal Server Error |
999999 | undefined error |
2. Call Product Information
Call in-game product information using UMyStoveSDKObject::StoveSDKFetchProducts.
// input parameters
// FString CategoryId: Category identifier registered by Partners (search all categories when passing an empty string)
// bool IsRefresh : If true, search Web API, if false, search PC SDK Cache
FStoveResult UMyStoveSDKObject::StoveSDKFetchProducts(const FString& CategoryId, const bool IsRefresh)
{
/*Add the 'walkthrough' codes here.*/
FStoveResult ErrorResult = Super::StoveSDKFetchProducts(CategoryId, IsRefresh);
if (ErrorResult.Result == StovePCResult::STOVE_PC_NO_ERROR)
{
// success handling
}
return ErrorResult;
}
C++
복사
When UMyStoveSDKObject::StoveSDKFetchShopCategories is successful, OnFetchProducts callback is called.
The FStoveProduct structure passed to the callback contains meta information about the product.
•
FStoveProduct.ProductId: Product ID
•
FStoveProduct.GameItemId: In-game item ID mapped to Product ID
•
FStoveProduct.Name : Product Name
•
FStoveProduct.Description : Product Description
•
FStoveProduct.Quantity: Quantity of each product
•
FStoveProduct.ProductTypeCode : Product Type Code
(1: Game Product, 2: In-game Product, 3: Package Product)
•
FStoveProduct.CategoryId : Category ID
•
FStoveProduct.CurrencyCode : Currency code
•
FStoveProduct.Price: Listed price of the Product
(if the CurrencyCode is equal to "KRW", the decimal point is omitted; if it is different, the second decimal place is indicated)
•
FStoveProduct.SalePrice: Sales Price of the Product
(if the CurrencyCode is equal to "KRW", the decimal point is omitted; if it is different, it is indicated to the second decimal place)
•
FStoveProduct.IsDiscount: Discount Availability
•
FStoveProduct.DiscountType: Discount Type (1: rate, 2: price)
•
FStoveProduct.DiscountTypeValue: Discount Value
•
FStoveProduct.DiscountBeginDate : Discount Start Date (UTC+0)
•
FStoveProduct.DiscountEndDate : Discount End Date (UTC+0)
•
FStoveProduct.TotalQuantity: Total Quantity of Product Sales
•
FStoveProduct.MemberQuantity: Purchase Quantity (by a user)
•
FStoveProduct.GuidQuantity: Purchase Quantity (purchase quantity of product purchase subject [CharacterNo/Guid/MemberNo])
•
FStoveProduct.ThumbnailUrl : Representative Product Image
void UMyStoveSDKObject::OnFetchProducts(int Size, FStoveProduct* Products)
{
/*Add the 'walkthrough' codes here.*/
OnLog("[OnFetchProducts]");
OnLog("Products Size = %d ", Size);
FString Builder;
for (int i = 0; i < Size; i++, Products++)
{
Builder.Append(FString::Printf(TEXT("-> Index : %d\n"), i));
Builder.Append(FString::Printf(TEXT("-------------------------------------- -----------------\n")));
Builder.Append(FString::Printf(TEXT(" ProductId : %I64d\n"), Products->ProductId));
Builder.Append(FString::Printf(TEXT(" GameItemId : %s\n"), *(Products->GameItemId)));
Builder.Append(FString::Printf(TEXT(" Name : %s\n"), *(Products->Name)));
Builder.Append(FString::Printf(TEXT(" Description : %s\n"), *(Products->Description)));
Builder.Append(FString::Printf(TEXT(" Quantity : %d\n"), Products->Quantity));
Builder.Append(FString::Printf(TEXT(" ProductTypeCode : %hd\n"), Products->ProductTypeCode));
Builder.Append(FString::Printf(TEXT(" CategoryId : %s\n"), *(Products->CategoryId)));
Builder.Append(FString::Printf(TEXT(" CurrencyCode : %s\n"), *(Products->CurrencyCode)));
if (Products->CurrencyCode.Compare(TEXT("KRW"), ESearchCase::IgnoreCase) == 0)
{
Builder.Append(FString::Printf(TEXT(" Price : %.0lf\n"), Products->Price));
Builder.Append(FString::Printf(TEXT(" SalePrice : %.0lf\n"), Products->SalePrice));
}
else
{
Builder.Append(FString::Printf(TEXT(" Price : %.2lf\n"), Products->Price));
Builder.Append(FString::Printf(TEXT(" SalePrice : %.2lf\n"), Products->SalePrice));
}
Builder.Append(FString::Printf(TEXT(" IsDiscount : %s\n"), Products->bIsDiscount ? TEXT("true") : TEXT("false")));
Builder.Append(FString::Printf(TEXT(" DiscountType : %hd\n"), Products->DiscountType));
Builder.Append(FString::Printf(TEXT(" DiscountTypeValue : %d\n"), Products->DiscountTypeValue));
Builder.Append(FString::Printf(TEXT(" DiscountBeginDate : %I64d\n"), Products->DiscountBeginDate));
Builder.Append(FString::Printf(TEXT(" DiscountEndDate : %I64d\n"), Products->DiscountEndDate));
Builder.Append(FString::Printf(TEXT(" TotalQuantity : %d\n"), Products->TotalQuantity));
Builder.Append(FString::Printf(TEXT(" MemberQuantity : %d\n"), Products->MemberQuantity));
Builder.Append(FString::Printf(TEXT(" GuidQuantity : %d\n"), Products->GuidQuantity));
Builder.Append(FString::Printf(TEXT(" ThumbnailUrl : %s\n"), *(Products->ThumbnailUrl)));
Builder.Append(FString::Printf(TEXT(" CanWithdraw : %s\n"), Products->bCanWithdraw ? TEXT("true") : TEXT("false")));
Builder.Append(FString::Printf(TEXT("-------------------------------------- -----------------\n")));
}
OnLog("%s", *Builder);
C++
복사
The OnError callback is called if an error occurs while running the UMyStoveSDKObject::StoveSDKFetchProducts. External errors can be checked through the ExternalError field of the FStoveError structure.
Below are the possible errors you might encounter.
ExternalError | Description |
500 | Internal Server Error
⇒ Please contact STOVE Onboarding Manager |
50001 | Store does not exist, or is under maintenance
⇒ Please check STOVE Studio |
50002 | Product does not exist or is unavailable for sale
⇒ Please check product(s) status in STOVE Studio |
999999 | undefined error
⇒ Please contact STOVE Onboarding Manager |