Log In

Linking Purchase Complete Event(Client)

To apply IWP purchase confirmation events in the World, you must create a new ZEPETOScript and link the OnPurchaseComplete and OnPurchaseFailed event functions.

Each function is designed to receive the following purchase comments:

OnPurchaseComplete(item)Callback called at the completion of the purchase.
OnPurchaseFailed(error)Callback called on purchase failure. ZEM will not be deducted, and will not be called if the user cancels the purchase.

You can find details on the item you purchased.

item.itemIdYou can access the purchased item via item ID.
item.nameYou can access the purchased item via item name.
item.descriptionYou can access the purchased item via item description.
item.priceYou can access the purchased item via item price.

In Scene, create a GameObject to link with IWP events, and add the ZEPETOScript below.

import { ZepetoScriptBehaviour } from 'ZEPETO.Script';

export default class IWPSample extends ZepetoScriptBehaviour {

    OnPurchaseComplete(item) {
        console.log(`item.itemId : ${item.itemId}, : ${}, item.description : ${item.description}, item.price : ${item.price}`);

    OnPurchaseFailed(error) {
        console.log(`OnPurchaseFailed : ${error.message}`);

Click the [+] button in the OnPurchaseCompletion and OnPurchaseFailed items from the ZEPETO IWP Button component to select the ZEPETO Script to link to the purchase event.

The ids in "ItemID" will populate based on the IWP items you've set up in the world console.


Please refer to the following guide. [Making World Products]



  • You must register a World cover image to do an item purchase test before publishing.
  • Please ensure you've entered a valid world cover image, otherwise you may encounter an error.


Screen when OnPurchaseComplete and OnPurchaseFailed are successfully linked

The Item ID value associated with zepetoIWPButton can also be set in code using the SetItemId function.

import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { ZepetoIWPButton } from 'ZEPETO.IWP';

export default class IWPTest extends ZepetoScriptBehaviour {

    public zepetoIWPButton: ZepetoIWPButton;

    Start() {