ZEPETO.Product
38 min
type description baseresponse /#baseresponse base class for response classes baserequest /#baserequest baserequest class that accepts a generic tresponse type as the response data productlistresponse /#productlistresponse the productlistresponse class provides the api call result and the retrieved product information list productbaseresponse /#productbaseresponse base class for product related response classes productresponse /#productresponse the productresponse class provides the api call result and the retrieved product information purchaseresponse /#purchaseresponse the productresponse class provides the api call result and the purchase information currencylistresponse /#currencylistresponse the currencylistresponse class provides the api call result and the currency information list currencyresponse /#currencyresponse the currencyresponse class provides the api call result and the currency information productrecord /#productrecord product information currencyrecord /#currencyrecord currency information itempackageunitrecord /#itempackageunitrecord details of individual products included in the item product package currencypackageunitrecord /#currencypackageunitrecord details of individual currencies included in the currency product package producttype /#producttype enum representing the product type purchasetype /#purchasetype enum representing the product purchase type productstatus /#productstatus enum representing the product status currencytype /#currencytype enum representing the currency type productservice /#productservice productservice manages operations associated with in world products players can access in world product information and perform purchases through this service productpurchasebutton /#productpurchasebutton class managing the functionality of an in world product purchase button producterror /#producterror the error code specifies the reason for the failure of product related requests officialcurrencybalancerequest /#officialcurrencybalancerequest represents an asynchronous request for retrieving the balance for zepeto’s official currency (zem) baseresponse class base class for response classes properties name type description issuccess boolean represents the success status of the request set to true upon successful completion message string describes the result of the request baserequest class · extends baseapirequest baserequest class that accepts a generic tresponse type as the response data properties name type description responsedata tresponse response data of the generic tresponse type productlistresponse class · extends productbaseresponse /#productbaseresponse the productlistresponse class provides the api call result and the retrieved product information list properties name type description products productrecord\[] /#productrecord list of product information productbaseresponse class · extends baseresponse /#baseresponse base class for product related response classes properties name type description errorcode producterror /#producterror retrieves the error code for a failed product request productresponse class · extends productbaseresponse /#productbaseresponse the productresponse class provides the api call result and the retrieved product information properties name type description product productrecord /#productrecord product information purchaseresponse class · extends productbaseresponse /#productbaseresponse the productresponse class provides the api call result and the purchase information properties name type description userid string user id of the player performed the purchase productid string id of the purchased in world product price number price of the purchased in world product receiptid string receipt id for the purchase purchasedat date date and time when the in world product was purchased currencylistresponse class · extends productbaseresponse /#productbaseresponse the currencylistresponse class provides the api call result and the currency information list properties name type description currencies currencyrecord\[] /#currencyrecord list of currency information currencyresponse class · extends productbaseresponse /#productbaseresponse the currencyresponse class provides the api call result and the currency information properties name type description currency currencyrecord /#currencyrecord currency information productrecord class product information properties name type description productid string product id name string product name price number product price ispurchased boolean indicates whether the user has purchased the product, applicable only for non consumable products itempackageunits itempackageunitrecord\[] /#itempackageunitrecord items included in the product if producttype is itempackage currencypackageunits currencypackageunitrecord\[] /#currencypackageunitrecord currencies included in the product if producttype is currencypackage producttype producttype /#producttype returns the producttype of the product purchasetype purchasetype /#purchasetype returns the purchasetype of the product productstatus productstatus /#productstatus returns the productstatus of the product currencytype currencytype /#currencytype returns the type of currency used for purchasing the product currencyid string returns the id of the currency used for purchasing the product currencyname string returns the name of the currency used for purchasing the product methods getcurrencysprite getcurrencysprite() → sprite returns the image of the currency used for purchasing the product returns sprite currencyrecord class currency information properties name type description currencyid string currency id name string currency name isofficialcurrency boolean indicates whether the currency is zepeto’s official currency (zem) or an in world currency itempackageunitrecord class details of individual products included in the item product package properties name type description productid string product id itemname string item name quantity bigint item quantity currencypackageunitrecord class details of individual currencies included in the currency product package properties name type description currencyid string currency id currencyname string currency name quantity bigint currency quantity producttype enum enum representing the product type name value description item 0 single item product itempackage 1 item product package, including multiple items currencypackage 2 currency product package, including multiple currencies purchasetype enum enum representing the product purchase type name value description consumable 0 consumable product nonconsumable 1 non consumable product productstatus enum enum representing the product status name value description active 0 active state inactive 1 inactive state forbidden 2 forbidden state due to expiration of use currencytype enum enum representing the currency type name value description officialcurrency 0 zepeto’s official currency (zem) usercurrency 1 in world currency productservice class productservice manages operations associated with in world products players can access in world product information and perform purchases through this service events name type description onpurchasecompleted (static) unityevent\<productrecord, purchaseresponse> event triggered upon a successful in world product purchase listeners can be added, receiving productrecord (the purchased product information) and purchaseresponse (the purchase result information) instances as arguments onpurchasefailed (static) unityevent\<productrecord, productbaseresponse> event triggered upon a failed in world product purchase listeners can be added, receiving productrecord (product information in the attempted purchase) and purchaseresponse (the unsuccessful purchase result information) instances as arguments methods getproductsasync static getproductsasync(productids string\[]) → baserequest\<productlistresponse> this asynchronous method retrieves the in world product list based on provided product ids parameter type description productids string\[] ids of the products to fetch returns baserequest\<productlistresponse> /#baserequest — a baserequest object when the asynchronous process is complete, you can access the productlistresponse object by the responsedata property getproductasync static getproductasync(productid string) → baserequest\<productresponse> this asynchronous method retrieves the in world product information based on the provided product id parameter type description productid string id of the product to fetch returns baserequest\<productresponse> /#baserequest — a baserequest object when the asynchronous process is complete, you can access the productresponse object by the responsedata property purchaseproductasync static purchaseproductasync(product productrecord, reason? string) → baserequest\<purchaseresponse> this asynchronous method performs a purchase to the in world product based on provided product information parameter type description product productrecord /#productrecord productrecord instance of the product to purchase reason (optional) string explanation for the purchase returns baserequest\<purchaseresponse> /#baserequest — a baserequest object when the asynchronous process is complete, you can access the purchaseresponse object by the responsedata property purchaseproductasync static purchaseproductasync(productid string, reason? string) → baserequest\<purchaseresponse> this asynchronous method performs a purchase to the in world product based on the provided product id parameter type description productid string id of the product to purchase reason (optional) string explanation for the purchase returns baserequest\<purchaseresponse> /#baserequest — a baserequest object when the asynchronous process is complete, you can access the purchaseresponse object by the responsedata property getcurrenciesasync static getcurrenciesasync() → baserequest\<currencylistresponse> asynchronous method to get a list of currencies upon completion, the list of currencies is obtained, and you can access the currencylistresponse object through the responsedata property returns baserequest\<currencylistresponse> /#baserequest getcurrencyasync static getcurrencyasync(currencyid string) → baserequest\<currencyresponse> this asynchronous method retrieves the in world currency information based on the provided product id parameter type description currencyid string id of the currency to fetch returns baserequest\<currencyresponse> /#baserequest — a baserequest object when the asynchronous process is complete, you can access the currencyresponse object by the responsedata property openpurchaseui static openpurchaseui(product productrecord) → void this method opens the in world product purchase ui parameter type description product productrecord /#productrecord productrecord instance of the product to purchase productpurchasebutton class class managing the functionality of an in world product purchase button properties name type description productid string gets the id of the in world product available for purchase product productrecord /#productrecord retrieves the in world product information associated with the productid methods setproductid setproductid(productid string) → void sets the id of an in world product available for purchase using this button parameter type description productid string product id producterror enum the error code specifies the reason for the failure of product related requests name value description unknown 1 error unknown error networkerror 0 error errors related to network issues, including disconnections or unstable connections usercanceled 1 error request is canceled by the user productrefreshresponseerror 2 error invalid product metadata in the request itempackageproductsresponseerror 3 error failed to retrieve one or more item information in the item product package iapcarderror 4 error failed to retrieve the on or more currency information in the currency product package productpricechanged 4001 error product price mismatch productalreadypurchased 4002 error product is already purchased balanceofficialcurrencynotenough 4003 error insufficient zepeto’s official currency (zem) balance for the purchase balanceusercurrencynotenough 4004 error insufficient in world currency balance for the purchase productnotactive 4005 error product is not active invalidcreator 4006 error player's user id differs from the world creator's user id this error only occurs in the development environment using the unity editor officialcurrencybalancerequest class · extends baserequest\<balanceresponse> /#baserequest represents an asynchronous request for retrieving the balance for zepeto’s official currency (zem)
