CREATE YOUR WORLD
Economy

Gifting API

11min
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 https //developer zepeto me/docs/module/namespaces/zepeto module shop ] 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 docid\ i xlh9pm 9fxgnw50gf9n ] 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