ZEPETO.Product
37 分
类型 说明 baseresponse /#baseresponse 响应类的基类。 baserequest /#baserequest 以泛型 tresponse 作为响应数据的 baserequest 类。 productlistresponse /#productlistresponse productlistresponse 类提供 api 调用结果以及获取到的商品信息列表。 productbaseresponse /#productbaseresponse 商品相关响应类的基类。 productresponse /#productresponse productresponse 类提供 api 调用结果以及获取到的商品信息。 purchaseresponse /#purchaseresponse productresponse 类提供 api 调用结果以及购买信息。 currencylistresponse /#currencylistresponse currencylistresponse 类提供 api 调用结果以及货币信息列表。 currencyresponse /#currencyresponse currencyresponse 类提供 api 调用结果以及货币信息。 productrecord /#productrecord 商品信息。 currencyrecord /#currencyrecord 货币信息。 itempackageunitrecord /#itempackageunitrecord 道具礼包中所含各个商品的详细信息。 currencypackageunitrecord /#currencypackageunitrecord 货币礼包中所含各个货币的详细信息。 producttype /#producttype 表示商品类型的枚举。 purchasetype /#purchasetype 表示商品购买类型的枚举。 productstatus /#productstatus 表示商品状态的枚举。 currencytype /#currencytype 表示货币类型的枚举。 productservice /#productservice productservice 用于管理与 world 内商品相关的操作。 玩家可通过该服务访问 world 内商品信息并进行购买。 productpurchasebutton /#productpurchasebutton 用于管理 world 内商品购买按钮功能的类。 producterror /#producterror 表示商品相关请求失败原因的错误代码。 officialcurrencybalancerequest /#officialcurrencybalancerequest 表示用于获取 zepeto 官方货币(zem)余额的异步请求。 baseresponse class 响应类的基类。 属性 名称 类型 说明 issuccess boolean 表示请求的成功状态。成功完成时设置为 true。 message string 描述请求的结果。 baserequest class · extends baseapirequest 以泛型 tresponse 作为响应数据的 baserequest 类。 属性 名称 类型 说明 responsedata tresponse 泛型 tresponse 类型的响应数据。 productlistresponse class · extends productbaseresponse /#productbaseresponse productlistresponse 类提供 api 调用结果以及获取到的商品信息列表。 属性 名称 类型 说明 products productrecord\[] /#productrecord 商品信息列表。 productbaseresponse class · extends baseresponse /#baseresponse 商品相关响应类的基类。 属性 名称 类型 说明 errorcode producterror /#producterror 获取失败的商品请求的错误代码。 productresponse class · extends productbaseresponse /#productbaseresponse productresponse 类提供 api 调用结果以及获取到的商品信息。 属性 名称 类型 说明 product productrecord /#productrecord 商品信息。 purchaseresponse class · extends productbaseresponse /#productbaseresponse productresponse 类提供 api 调用结果以及购买信息。 属性 名称 类型 说明 userid string 进行购买的玩家的用户 id。 productid string 已购买的 world 内商品 id。 price number 已购买的 world 内商品价格。 receiptid string 该次购买的收据 id。 purchasedat date 购买该 world 内商品的日期和时间。 currencylistresponse class · extends productbaseresponse /#productbaseresponse currencylistresponse 类提供 api 调用结果以及货币信息列表。 属性 名称 类型 说明 currencies currencyrecord\[] /#currencyrecord 货币信息列表。 currencyresponse class · extends productbaseresponse /#productbaseresponse currencyresponse 类提供 api 调用结果以及货币信息。 属性 名称 类型 说明 currency currencyrecord /#currencyrecord 货币信息。 productrecord class 商品信息。 属性 名称 类型 说明 productid string 商品 id。 name string 商品名称。 price number 商品价格。 ispurchased boolean 表示用户是否已购买该商品,仅适用于非消耗型商品。 itempackageunits itempackageunitrecord\[] /#itempackageunitrecord 当 producttype 为 itempackage 时,该商品所含的道具。 currencypackageunits currencypackageunitrecord\[] /#currencypackageunitrecord 当 producttype 为 currencypackage 时,该商品所含的货币。 producttype producttype /#producttype 返回该商品的 producttype 。 purchasetype purchasetype /#purchasetype 返回该商品的 purchasetype 。 productstatus productstatus /#productstatus 返回该商品的 productstatus 。 currencytype currencytype /#currencytype 返回购买该商品所使用的货币类型。 currencyid string 返回购买该商品所使用的货币 id。 currencyname string 返回购买该商品所使用的货币名称。 方法 getcurrencysprite getcurrencysprite() → sprite 返回购买该商品所使用的货币图片。 返回值: sprite currencyrecord class 货币信息。 属性 名称 类型 说明 currencyid string 货币 id。 name string 货币名称。 isofficialcurrency boolean 表示该货币是 zepeto 官方货币(zem)还是 world 内货币。 itempackageunitrecord class 道具礼包中所含各个商品的详细信息。 属性 名称 类型 说明 productid string 商品 id。 itemname string 道具名称。 quantity bigint 道具数量。 currencypackageunitrecord class 货币礼包中所含各个货币的详细信息。 属性 名称 类型 说明 currencyid string 货币 id。 currencyname string 货币名称。 quantity bigint 货币数量。 producttype enum 表示商品类型的枚举。 名称 值 说明 item 0 单个道具的商品。 itempackage 1 包含多个道具的道具礼包商品。 currencypackage 2 包含多种货币的货币礼包商品。 purchasetype enum 表示商品购买类型的枚举。 名称 值 说明 consumable 0 消耗型商品。 nonconsumable 1 非消耗型商品。 productstatus enum 表示商品状态的枚举。 名称 值 说明 active 0 启用状态。 inactive 1 停用状态。 forbidden 2 因使用期限到期而被禁用的状态。 currencytype enum 表示货币类型的枚举。 名称 值 说明 officialcurrency 0 zepeto 官方货币(zem) usercurrency 1 world 内货币。 productservice class productservice 用于管理与 world 内商品相关的操作。 玩家可通过该服务访问 world 内商品信息并进行购买。 事件 名称 类型 说明 onpurchasecompleted (static) unityevent\<productrecord, purchaseresponse> world 内商品购买成功时触发的事件。可添加监听器,监听器会接收 productrecord (已购买商品的信息)和 purchaseresponse (购买结果信息)实例作为参数。 onpurchasefailed (static) unityevent\<productrecord, productbaseresponse> world 内商品购买失败时触发的事件。可添加监听器,监听器会接收 productrecord (尝试购买的商品信息)和 purchaseresponse (失败的购买结果信息)实例作为参数。 方法 getproductsasync static getproductsasync(productids string\[]) → baserequest\<productlistresponse> 该异步方法根据提供的商品 id 获取 world 内商品列表。 参数 类型 说明 productids string\[] 要获取的多个商品 id。 返回值: baserequest\<productlistresponse> /#baserequest — 一个 baserequest 对象。异步处理完成后,可通过 responsedata 属性访问 productlistresponse 对象。 getproductasync static getproductasync(productid string) → baserequest\<productresponse> 该异步方法根据提供的商品 id 获取 world 内商品信息。 参数 类型 说明 productid string 要获取的商品 id。 返回值: baserequest\<productresponse> /#baserequest — 一个 baserequest 对象。异步处理完成后,可通过 responsedata 属性访问 productresponse 对象。 purchaseproductasync static purchaseproductasync(product productrecord, reason? string) → baserequest\<purchaseresponse> 该异步方法根据提供的商品信息购买 world 内商品。 参数 类型 说明 product productrecord /#productrecord 要购买商品的 productrecord 实例。 reason (可选) string 对该次购买的说明。 返回值: baserequest\<purchaseresponse> /#baserequest — 一个 baserequest 对象。异步处理完成后,可通过 responsedata 属性访问 purchaseresponse 对象。 purchaseproductasync static purchaseproductasync(productid string, reason? string) → baserequest\<purchaseresponse> 该异步方法根据提供的商品 id 购买 world 内商品。 参数 类型 说明 productid string 要购买的商品 id。 reason (可选) string 对该次购买的说明。 返回值: baserequest\<purchaseresponse> /#baserequest — 一个 baserequest 对象。异步处理完成后,可通过 responsedata 属性访问 purchaseresponse 对象。 getcurrenciesasync static getcurrenciesasync() → baserequest\<currencylistresponse> 用于获取货币列表的异步方法。 处理完成后即可获得货币列表,并可通过 responsedata 属性访问 currencylistresponse 对象。 返回值: baserequest\<currencylistresponse> /#baserequest getcurrencyasync static getcurrencyasync(currencyid string) → baserequest\<currencyresponse> 该异步方法根据提供的商品 id 获取 world 内货币信息。 参数 类型 说明 currencyid string 要获取的货币 id。 返回值: baserequest\<currencyresponse> /#baserequest — 一个 baserequest 对象。异步处理完成后,可通过 responsedata 属性访问 currencyresponse 对象。 openpurchaseui static openpurchaseui(product productrecord) → void 该方法用于打开 world 内商品购买 ui。 参数 类型 说明 product productrecord /#productrecord 要购买商品的 productrecord 实例。 productpurchasebutton class 用于管理 world 内商品购买按钮功能的类。 属性 名称 类型 说明 productid string 获取可供购买的 world 内商品 id。 product productrecord /#productrecord 获取与 productid 关联的 world 内商品信息。 方法 setproductid setproductid(productid string) → void 设置可通过该按钮购买的 world 内商品 id。 参数 类型 说明 productid string 商品 id。 producterror enum 表示商品相关请求失败原因的错误代码。 名称 值 说明 unknown 1 错误:未知错误。 networkerror 0 错误:与网络问题相关的错误,包括连接中断或连接不稳定。 usercanceled 1 错误:请求已被用户取消。 productrefreshresponseerror 2 错误:请求中的商品元数据无效。 itempackageproductsresponseerror 3 错误:未能获取道具礼包中一个或多个道具的信息。 iapcarderror 4 错误:未能获取货币礼包中一个或多个货币的信息。 productpricechanged 4001 错误:商品价格不匹配。 productalreadypurchased 4002 错误:该商品已购买。 balanceofficialcurrencynotenough 4003 错误:zepeto 官方货币(zem)余额不足,无法完成购买。 balanceusercurrencynotenough 4004 错误:world 内货币余额不足,无法完成购买。 productnotactive 4005 错误:商品未处于启用状态。 invalidcreator 4006 错误:玩家的用户 id 与 world 创作者的用户 id 不一致。该错误仅在使用 unity 编辑器的开发环境中出现。 officialcurrencybalancerequest class · extends baserequest\<balanceresponse> /#baserequest 表示用于获取 zepeto 官方货币(zem)余额的异步请求。
