ZEPETO.Multiplay.Currency
Type | Description |
|---|---|
The error code specifies the reason for the failure of in-World currency-related requests. | |
Currency | Currency manages operations associated with ZEPETO World currencies. |
CurrencyError
enum
The error code specifies the reason for the failure of in-World currency-related requests.
Name | Value | Description |
|---|---|---|
Unknown | -1 | Error: Unknown error. |
NetworkError | 0 | Error: Errors related to network issues, including disconnections or unstable connections. |
Currency
interface
Currency manages operations associated with ZEPETO World currencies.
Methods
debit
debit(id: string, quantity?: number, reason?: string) → Promise<boolean>
Deducts the specified amount from the player's in-World currency balance. Throws CurrencyError.
Parameter | Type | Description |
|---|---|---|
id | string | ID of the currency to deduct. |
quantity (optional) | number | The quantity of the currency to deduct. Defaults to 1. |
reason (optional) | string | Optionally describes the reason for deduction. |
Returns: Promise<boolean> — Promise resolved upon completion, indicating success (true) or failure (false).
credit
credit(id: string, quantity?: number, reason?: string) → Promise<boolean>
Increases the specified amount to the player's in-World currency balance. Throws CurrencyError.
Parameter | Type | Description |
|---|---|---|
id | string | ID of the currency to increase. |
quantity (optional) | number | The quantity of the currency to increase. Defaults to 1. |
reason (optional) | string | Optionally describes the reason for increase. |
Returns: Promise<boolean> — Promise resolved upon completion, indicating success (true) or failure (false).
getBalance
getBalance(id: string) → Promise<number>
Retrieves the balance of the player's in-World currency. Throws CurrencyError.
Parameter | Type | Description |
|---|---|---|
id | string | ID of the currency to retrieve. |
Returns: Promise<number> — Promise resolved upon completion, with the retrieved balance amount.
getBalances
getBalances() → Promise<{ [key: string]: number }>
Retrieves the balances of each in-World currency the player has. Throws CurrencyError.
Returns: Promise<{ [key: string]: number }> — Promise resolved upon completion, with the object where each in-World currency ID is a key, and its corresponding balance is the associated value.