//////////
Search
Duplicate

Call Shop and Product Information

태그

1. Call Shop Categories

The StovePC.FetchShopCategories 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)
StovePCResult result = StovePC.FetchShopCategories(); if(result == StovePCResult.NoError) { // handle success }
C++
복사
When the StovePC.FetchShopCategories function is successfully processed, the OnFetchShopCategories callback is called.
The StovePCShopCategory structure passed to the callback contains meta information about the store category.
StovePCShopCategory.CategoryId : CategoryID
StovePCShopCategory.ParentCategoryId: Parent CategoryID
StovePCShopCategory.DisplayNo: Category Order
StovePCShopCategory.Name: Category Name
StovePCShopCategory.Depth: Category Depth (1 for the highest category)
private void OnFetchShopCategories(StovePCShopCategory[] categories) { StringBuilder sb = new StringBuilder(); sb.AppendLine("OnFetchShopCategories"); sb.AppendFormat(" - categories.Length : {0}" + Environment.NewLine, categories.Length); for (int i = 0; i < categories.Length; i++) { sb.AppendFormat(" - categories[{0}].CategoryId : {1}" + Environment.NewLine, i, categories[i].CategoryId); sb.AppendFormat(" - categories[{0}].ParentCategoryId : {1}" + Environment.NewLine, i, categories[i].ParentCategoryId); sb.AppendFormat(" - categories[{0}].DisplayNo : {1}" + Environment.NewLine, i, categories[i].DisplayNo.ToString()); sb.AppendFormat(" - categories[{0}].Name : {1}" + Environment.NewLine, i, categories[i].Name); sb.AppendFormat(" - categories[{0}].Depth : {1}", i, categories[i].Depth.ToString()); if (i < categories.Length - 1) sb. AppendFormat(Environment. NewLine); } Debug.Log(sb.ToString()); }
C++
복사
The OnError callback is called if an error occurs while running the StovePC.FetchShopProducts function. External errors can be checked through the ExternalError field of the StovePCError structure.
ExternalError
Description
500
Internal Server Error
999999
undefined error

2. Call Product Information

Call in-game product information using StovePC.FetchProducts function.
// input parameters // string categoryId : Category identifier registered in STOVE Studio (when passing an empty string, search all categories) // bool isRefresh : If true, search Web API, if false, search PC SDK Cache StovePCResult result = StovePC.FetchProducts("CATEGORY_ID", IS_REFRESH); if(result == StovePCResult.NoError) { // handle success }
C++
복사
When StovePC.FetchProducts is successful, OnFetchProducts callback is called.
The StovePCProduct structure passed to the callback contains meta information about the product.
StovePCProduct.ProductId : ProductID
StovePCProduct.GameItemId : In-game item ID mapped to ProductID
StovePCProduct.Name : Product Name
StovePCProduct.Description : Product Description
StovePCProduct.Quantity: Quantity of Each Product
StovePCProduct.ProductTypeCode : Product Type Code (1: Game Product, 2: in-game product, 3: Package item)
StovePCProduct.CategoryId : CategoryID
StovePCProduct.CurrencyCode : Currency code
StovePCProduct.Price: Listed 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)
StovePCProduct.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)
StovePCProduct.IsDiscount: Discount Availability
StovePCProduct.DiscountType : Discount Type (1: rate, 2: price)
StovePCProduct.DiscountTypeValue: Discount Value
StovePCProduct.DiscountBeginDate : Discount Start Date (UTC+0)
StovePCProduct.DiscountEndDate : Discount End Date (UTC+0)
StovePCProduct.TotalQuantity : Total Quantity of Product Sales
StovePCProduct.MemberQuantity : Purchase Quantity (by a user)
StovePCProduct.GuidQuantity: Purchase Quantity (purchase quantity of product purchase subject [CharacterNo/Guid/MemberNo])
StovePCProduct.ThumbnailUrl : Representative Product Image
private void OnFetchProducts(StovePCProduct[] products) { StringBuilder sb = new StringBuilder(); sb.AppendLine("OnFetchProducts"); sb.AppendFormat(" - products.Length : {0}" + Environment.NewLine, products.Length); for (int i = 0; i < products.Length; i++) { sb.AppendFormat(" - products[{0}].ProductId : {1}" + Environment.NewLine, i, products[i].ProductId.ToString()); sb.AppendFormat(" - products[{0}].GameItemId : {1}" + Environment.NewLine, i, products[i].GameItemId); sb.AppendFormat(" - products[{0}].Name : {1}" + Environment.NewLine, i, products[i].Name); sb.AppendFormat(" - products[{0}].Discription : {1}" + Environment.NewLine, i, products[i].Discription); sb.AppendFormat(" - products[{0}].Quantity : {1}" + Environment.NewLine, i, products[i].Quantity.ToString()); sb.AppendFormat(" - products[{0}].ProductTypeCode : {1}" + Environment.NewLine, i, products[i].ProductTypeCode.ToString()); sb.AppendFormat(" - products[{0}].CategoryId : {1}" + Environment.NewLine, i, products[i].CategoryId); sb.AppendFormat(" - products[{0}].CurrencyCode : {1}" + Environment.NewLine, i, products[i].CurrencyCode); sb.AppendFormat(" - products[{0}].Price : {1}" + Environment.NewLine, i, products[i].CurrencyCode == "KRW" ? products[i].Price.ToString("F0" ) : products[i].Price.ToString("F2")); sb.AppendFormat(" - products[{0}].SalePrice : {1}" + Environment.NewLine, i, products[i].CurrencyCode == "KRW" ? products[i].SalePrice.ToString("F0" ) : products[i].SalePrice.ToString("F2")); sb.AppendFormat(" - products[{0}].IsDiscount : {1}" + Environment.NewLine, i, products[i].IsDiscount.ToString()); sb.AppendFormat(" - products[{0}].DiscountType : {1}" + Environment.NewLine, i, products[i].DiscountType.ToString()); sb.AppendFormat(" - products[{0}].DiscountTypeValue : {1}" + Environment.NewLine, i, products[i].DiscountTypeValue.ToString()); sb.AppendFormat(" - products[{0}].DiscountBeginDate : {1}" + Environment.NewLine, i, products[i].DiscountBeginDate.ToString()); sb.AppendFormat(" - products[{0}].DiscountEndDate : {1}" + Environment.NewLine, i, products[i].DiscountEndDate.ToString()); sb.AppendFormat(" - products[{0}].TotalQuantity : {1}" + Environment.NewLine, i, products[i].TotalQuantity.ToString()); sb.AppendFormat(" - products[{0}].MemberQuantity : {1}" + Environment.NewLine, i, products[i].MemberQuantity.ToString()); sb.AppendFormat(" - products[{0}].GuidQuantity : {1}" + Environment.NewLine, i, products[i].GuidQuantity.ToString()); sb.AppendFormat(" - products[{0}].ThumbnailUrl : {1}", i, products[i].ThumbnailUrl); if (i < products.Length - 1) sb. AppendFormat(Environment. NewLine); } Debug.Log(sb.ToString()); }
C++
복사
If an error occurs while running the StovePC.FetchProducts function, the OnError callback is called. External errors can be checked through the ExternalError field of the StovePCError 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