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.6 or higher first.

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

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


Gifting API

  • To use the gifting API, add the import statement below.
import { GiftBackgroundType, ShopService, ItemGiftResponse } from 'ZEPETO.Module.Shop';

ShowGiftPopup Function

  • Declaration
    • ShowGiftPopup($itemCode: string, $targetUserId: string, $backgroundType: GiftBackgroundType, $giftMessage?: string, $onComplete?: System.Action$1, $onFailure?: System.Action$1<ZEPETO_Module.ErrorCode>):void;
  • Parameters
parameterDescription
itemCodeID of the item to be gifted
targetUserIdUserId of the recipient for the gift.
Please note that this is not the same as ZEPETO ID.
backgroundTypeBackground type to be used for gift notification pop-up (Type01~Type04)
giftMessageMessage to be sent along with sending a gift, space "" can be entered
onCompleteCallback to receive the result upon final completion of gifting
onFailureCallback to receive the result when an error occurs

ItemGiftResponse

ResponseDescription
zemZEM balance remaining after completing gifting
coinCoin balance remaining after completing gifting

Situation by ErrorCode

ResponseDescription
37021Item price changed
37001Item already purchased (gifted), the other person already owns it
33101Disabled, discontinued items
37017Items that cannot be used for some reason
37013No gifts to yourself (policy)
37011Guest status: No gifts allowed
31002There is no user to receive the gift
37010Gifts available 30 days after account creation
37012Message sent with gift is inappropriate
33204Lack of goods to purchase items to give as gifts
37018A state in which the user refuses to receive a gift, a state in which the user refuses the gift.
0Common network errors
-1Unidentifiable error

❗️

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.