How to use FINGI API to sync your virtual assets with FINGI marketplace.


Prerequisites

To use FINGI API you need to Create app and get FINGI API key first. Please, read these links if you don't know where to start.


How FINGI API works

To understand better how FINGI works imagine it as a blockchain backed Git for in-app or in-game virtual assets. Our api can handle almost any type of items and in-app purchases there is. Be it standard ones like: in-app consumable purchases, subscriptions or permanent license; or random loot drop stored in inventory, craft materials, cosmetics, time-limited boosters or lootboxes. If this item has a valid url, that is recognized in your game or app — it can be wrapped in token and sold through FINGI marketplace, transfered to another wallet or even traded on other platforms (because our token is based on standard ERC-1155 by OpenZeppelin) by the app/game owner or a general user or player, allowing your users to earn cryptocurrency while playing your game or using your app. Ang you'll get the royalty for every transaction made within our marketplace.

Other possible usages of FINGI API: sell music tracks and albums as tokens, ebooks, gift cards, coupons, permanent VIP memberships, subscription to services. Or even a real world items like coffee or gym memberships. If this item has a url, some backend to handle clients interaction with it and a way to authenticate clients, you can introduce tokenomics and crypto payments into your business almost effortless. We'll do all the heavy lifting on the blockchain side. All you need to do is to attach a Metamask wallet to your account to receive revenue and royalty.


There are 3 types of tokens on FINGI:

1) Permanent: tokens for cosmetic items, weapon skins, costumes, permanent memberships etc. These types of tokens get synchronized with game/app directly while they are on chain. So you get to use these items inside the app while the wallet associated with your account contains these tokens.
2) Mergeable: tokens for random drop items, spendables, craft materials and in-game currency. To get these back you have to click merge on item in Assets / Tokens, this way specified number of tokens will get burned on the chain and removed from your wallet and items will get into merge section and appear in game/app some time later. Probably at the next launch.
3) Time Limited: tokens for subscriptions and time-limited boosters. You can activate token by burning it on chain and it will increase the time limit of the specific subscription or booster in game or app. The FINGI API synchronizes the active token time limits directly from blockchain.


Limitations of items and tokens to consider:

Virtual assets that can exist on blockchain and in-game simultaneously are: Permanent and Time Limited. These items can be directly accessed by polling the blockchain through our api. They are suitable for in-game cosmetics, temporary boosters or subscriptions, memberships... anything that is permanent or have a time limit. But they can't be a random drop or consumable.

Mergeable virtual assets can represent random loot, in-game currency, consumable items or craft materials, as well as coupon or a gift card. Something that a user can create or acquire inside the game or app and then spend it or loose it. This item must have unique generated URL, recognized by your game and unique to this item or type of items (if it's in-game currency, consumable or a craft mat). Mergeable assets can not be on-chain and in-game simultaneously. When these items are minted or sold, the amount of items transfered is subtracted from synced users inventory on FINGI side. Remember to pull the status of the inventory to keep it in sync with FINGI.

To get tokenized or sold items back inside the app or game — user has to Merge them (by burning the token) or cancel the sell order. After that items will appear in Merge section, which should merged back to the app or game on next launch after the inventory status pull if possible.

If Merge logic can not be executed directly because of in-game rules and limitations (not enough space in inventory). Partial Merge can be applied. This way the merge only pulls specified number of items and subtracts this amount from the merge entry, so user don't loose any of their items.



The basic idea of how the flow of syncing in-game items with FINGI API should be implemented:


- Permanent items (like life-time licenses or cosmetic items: costumes, weapon skins, models, etc...), pre-minted by app owner and sold through FINGI marketplace. Or they can be distributed inside the game by other means like in-app purchases and tokenized later by users. But by this way it's up to you to track non-tokenized cosmetics, because it will not be shown in /owned_tokens list.

- Same is true for the time-limited items (like boosters or subscriptions), owner of the app should mint initial supply of these tokens and sell them through FINGI. But these items may also be distributed by other means inside the app and tokenized later. For these items to be tracked by /active_subs endpoint they should be minted AND burned by the user. FINGI API can't track activated items if they were not activated on blockchain.

- The flow around mergeable items is the most interesting part. As we see it: the game developer should create a "stash" that will be in sync with FINGI API. When user opens the stash - the /pull_items should be called and items in stash updated with the current status of users inventory as it is on FINGI.
Then call /peek_merge_pending and fill up the free space in stash with items from merge list by calling /merge_items on items that are successfully put there. After that call /push_items to update FINGI inventory with merged items. And call /push_items each time user interacts with the stash inside the game.