Skip to main content

Currency

ZEPETO.Multiplay.Currency.Currency

Currency manages operations associated with ZEPETO World currencies.

Methods

credit

credit(id, quantity?, reason?): Promise<boolean>

Increases the specified amount to the player's in-World currency balance. Throws CurrencyError.

Parameters

NameTypeDescription
idstringID of the currency to increase.
quantity?numberOptional The quantity of the currency to increase. Defaults to 1.
reason?stringOptional Optionally describes the reason for increase.

Returns

Promise<boolean>

Promise resolved upon completion, indicating success (true) or failure (false).


debit

debit(id, quantity?, reason?): Promise<boolean>

Deducts the specified amount from the player's in-World currency balance. Throws CurrencyError.

Parameters

NameTypeDescription
idstringID of the currency to deduct.
quantity?numberOptional The quantity of the currency to deduct. Defaults to 1.
reason?stringOptional Optionally describes the reason for deduction.

Returns

Promise<boolean>

Promise resolved upon completion, indicating success (true) or failure (false).


getBalance

getBalance(id): Promise<number>

Retrieves the balance of the player's in-World currency. Throws CurrencyError.

Parameters

NameTypeDescription
idstringID 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.