Understanding VI Tech IDs

In order to set up virtual items (VIs) in TROPHiT, you need to know your VI's technical identifiers as your app already defines them internally. It's usually the decision of the tech team on how to represent each VI inside the app and they should be the ones providing this information. This article is designed to help the tech team understand how to provide those tech IDs correctly to TROPHiT.

Regardless of TROPHiT, when it's time to give your users some virtual items (for completing a game level, for example), your app usually does this by activating a certain existing mechanism to update the user's virtual item balance. To distinguish between the various virtual items, your app usually has a way to internally identify each one. Here are some common examples used by apps to add VIs to their users while distinguishing between different VIs:

Server-Side CRM Function

Consider an existing server-side CRM function addCurrency(userId, itemTypeId, quantity) used as follows:

  • addCurrency("aabbcc", "12345", 500) adds 500 Gold, identified by the type ID "12345" to user ID "aabbcc"
  • addCurrency("aabbcc", "56789", 10) adds 10 Gems, identified by the type ID "56789" to the same user

As you can see, Gold and Gems are distinguished by their type ID, so when setting up your VIs in TROPHiT, specify "12345" and "56789" as Tech IDs for Gold and Gems, respectively:

Client-Side VI Manager Class

Consider an existing client-side class with methods like:

  • addGold(500) adds 500 gold to the current user
  • addGems(10) adds 10 gems to the current user
  • add...

As you can see, Gold and Gems are distinguished by their method name, so when setting up your VIs in TROPHiT, you have more freedom on how to specify your tech IDs. For example, you can simply use "Gold" and "Gems" as tech IDs in TROPHiT:

Later, when TROPHiT notifies your app of a tech ID to redeem, it might be tempting to write a switch-like statement such as:

if (typeId == "Gold")
else if (typeId == "Gems")
else if ...

However, you might want to enable more types of VIs through TROPHiT later on without changing your app's code over and over, so a more generic approach might make sense. For example, using Reflection (Android) or @selectors (ObjC) to invoke the correct method:

viManager.callMethod("add" + typeId, quantity);
(this is pseudo code, of course...)

Special Considerations

Sometimes, the technical ID of an item comprises of multiple numbers, e.g. code "1234" with subcode "5678". In such a case, we recommend you define the technical name as something like "1234.5678" and later parse it during integration, back into code "1234" and subcode "5678":


Please sign in to leave a comment.
Powered by Zendesk