ZEPETO.Product
Type | Description |
|---|---|
BaseResponse | Base class for response classes. |
BaseRequest | BaseRequest class that accepts a generic TResponse type as the response data. |
The ProductListResponse class provides the API call result and the retrieved product information list. | |
Base class for product-related response classes. | |
The ProductResponse class provides the API call result and the retrieved product information. | |
The ProductResponse class provides the API call result and the purchase information. | |
The CurrencyListResponse class provides the API call result and the currency information list. | |
The CurrencyResponse class provides the API call result and the currency information. | |
Product information. | |
Currency information. | |
Details of individual products included in the item product package. | |
Details of individual currencies included in the currency product package. | |
ProductType | Enum representing the product type. |
PurchaseType | Enum representing the product purchase type. |
Enum representing the product status. | |
CurrencyType | Enum representing the currency type. |
ProductService manages operations associated with in-World products. Players can access in-World product information and perform purchases through this service. | |
Class managing the functionality of an in-World product purchase button. | |
ProductError | The error code specifies the reason for the failure of product-related requests. |
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
The ProductListResponse class provides the API call result and the retrieved product information list.
Properties
Name | Type | Description |
|---|---|---|
products | List of product information. |
ProductBaseResponse
class · extends BaseResponse
Base class for product-related response classes.
Properties
Name | Type | Description |
|---|---|---|
ErrorCode | ProductError | Retrieves the error code for a failed product request. |
ProductResponse
class · extends ProductBaseResponse
The ProductResponse class provides the API call result and the retrieved product information.
Properties
Name | Type | Description |
|---|---|---|
product | Product information. |
PurchaseResponse
class · extends 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
The CurrencyListResponse class provides the API call result and the currency information list.
Properties
Name | Type | Description |
|---|---|---|
currencies | List of currency information. |
CurrencyResponse
class · extends ProductBaseResponse
The CurrencyResponse class provides the API call result and the currency information.
Properties
Name | Type | Description |
|---|---|---|
currency | 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 | Items included in the product if ProductType is ItemPackage. | |
currencyPackageUnits | Currencies included in the product if ProductType is CurrencyPackage. | |
ProductType | ProductType | Returns the ProductType of the product. |
PurchaseType | PurchaseType | Returns the PurchaseType of the product. |
ProductStatus | Returns the ProductStatus of the product. | |
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> — 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> — 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 instance of the product to purchase. | |
reason (optional) | string | Explanation for the purchase. |
Returns: BaseRequest<PurchaseResponse> — 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> — 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>
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> — 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 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 | 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>
Represents an asynchronous request for retrieving the balance for ZEPETO’s official currency (ZEM).