question

dragonpang avatar image
dragonpang asked

Hi, if i have multiple virtual currency and i have feature of converting from one virtual currency to another currency then what apis i should use ?

apis
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

We suggest to use Cloud Script to implement this feature.

For example, you are implementing an exchange mechanism that VC_1 can be exchanged for any other VC, such as VC_2, and things you need to do:

    1. Maintain an exchange rate table either on title data or directly in Cloud Script
    2. Implement an Cloud Script that receives the target VC type (for example, VC_2) and then the quantity
    3. The function in Cloud Script will firstly calculate how much VC_1 will be needed according to the rate table.
    4. Check if the player is capable of doing the exchange.
    5. If it is valid, call SubtractUserVirtualCurrency to reduce the VC_1, and then call AddUserVirtualCurrency to increase the VC_2.
    6. If invalid, return failure.

              Normally, a player’s profile data, including inventory and VC information will be stored locally in the client. Before initiating the exchange process, you can process another check in the client(for example you can add a slider bar which will show the maximum number of target VC that the player can exchange). But be aware that there should always be verification steps in the Cloud Script in case of abusive uses or cheats.

              1 comment
              10 |1200

              Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

              Seth Du avatar image Seth Du ♦ commented ·

              After the discussion with our team, there is an interesting thing we want to share with you. On step 5, you may reverse the order of granting VC operation (add VC_2 first, then subtract VC_1) because there is a rare chance that the second operation may fail. if the players are granted with target VC first but the original VC isn't subtracted, they are unlikely to report for bonus VC and since it is very rare case, you won't worry about abusive uses. These will also help to reduce the custom service pressure:)

              0 Likes 0 ·

              Write an Answer

              Hint: Notify or tag a user in this post by typing @username.

              Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.