Studio GuideWorld SDK Guide
Log In

Gifting API

You can use the gifting API to gift clothing items to other users within ZEPETO World.

However, when using the API, the sender's goods will be deducted.


Install

Window → Package Manager → ZEPETO.World Package Please install version 1.21.14 or higher first.

Afterward, please install the ‘ZEPETO.Module’ package with a version of 1.0.7 or higher.

Ensure that the ZEPETO app is running the version 3.46.000 or higher.


Gifting API

To use the gifting API, add the import statement below.

import { GiftBackgroundType, ShopService, ItemGiftResponse } from 'ZEPETO.Module.Shop';

If you're interested in the Gifting API, refer to the documentation:

📘

Please refer to the following guide. [ZEPETO.Module.Shop API]


❗️

Caution

  • In the Unity editor, you can test both success and failure cases. Even if gifting is successful, it will not deduct any currency, and the gift will not be delivered to the recipient.
  • During mobile testing via QR codes or test links, successful transactions will result in actual currency deduction and the gift will be delivered to the recipient.

Usage example

  • Please add a Send Gift Button to the Canvas.
  • Please write the example code as below.
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { GiftBackgroundType, ShopService, ItemGiftResponse } from 'ZEPETO.Module.Shop';
import { Button } from 'UnityEngine.UI';
import { ErrorCode } from 'ZEPETO.Module';
 
export default class SendGift extends ZepetoScriptBehaviour {
 
    public itemId : string;
    public targetUserId : string;
    public sendGiftButton : Button;
 
    Start() {
        this.sendGiftButton.onClick.AddListener(()=>{
            ShopService.ShowGiftPopup(
                this.itemId,
                this.targetUserId,
                GiftBackgroundType.Type01,
                "Hi This is for you!",
                (response: ItemGiftResponse) => {  // onComplete callback
                    console.log(`Gift sent successfully! ZEPETO Coin Balance ${response.coin}, ZEM Balance ${response.zem}`);
                },
                (error: ErrorCode) => {  // onFailure callback
                    console.error("Error sending gift:", error);
                }
            );
        });
    }
}

  • After writing the script, connect the button in the inspector and enter the userID and itemID of the person who will receive the gift.

📘

Please refer to the following guide on how to obtain Zepeto Player's UserId. [ZEPETO Player]


  • To test success or failure cases, create a QR code and then test on your mobile device.
  • However, please note that the sender's goods will be deducted.

When sending a gift is successful

  • When you click the button, a pop-up UI for sending a gift will appear.

  • If the gift is sent successfully, a Toast UI will appear to indicate success, and the example script will generate a log


  • Additionally, a gift has arrived for targetUser.

When sending a gift fails

  • If the case corresponds to ErrorCode, an error message will be displayed in the Toast UI, and the example script will output the corresponding error code.