Virtual Currencies

The PlayFab Virtual Currencies Module is specifically designed to manage the application's virtual store and currency.

The features include purchases, consumables, redeemable coupons, virtual stores, item catalogs and very your own virtual currencies. 

The store list, catalog items, virtual currencies and transaction data are accessible through the PlayFab Console. 

The implementation of virtual stores in your applications will be easier with this addon.

Intstructions

1. The first step is to add the PlayFab API addon into the project.

2. Then, add the Authentication addon into the project.

3. Finally, add the Virtual Currencies addon into the project.

Features :

  • Advanced to simple purchases.

  • Consumables and redeem coupons.

  • Virtual Currencies.

  • Store Console and versioning.

  • Account synced and profiled.

  • Organized request and update feature.

Network Services :

  • Facebook

  • Google Plus

  • Game Center

  • Google Play

  • Facebook Instant Games

  • Steam

  • Xbox Live

  • Nintendo Switch

  • PS4

  • PlayFab

 

Actions, Conditions & Expressions

Actions

Virtual Currency :

  • Add User Currency - Increments the user's balance of the specified virtual currency by the stated amount.

    • Virtual Currency - Name of the virtual currency which is to be incremented.

    • Amount - Amount to be added to the user balance of the specified virtual currency.

    • Tag - The tag to differentiate requests.

  • Subtract User Currency - Decrements the user's balance of the specified virtual currency by the stated amount. A Negative Balance is possible.

    • Virtual Currency - Name of the virtual currency which is to be decremented.

    • Amount - Amount to be subtracted from the user balance of the specified virtual currency.

    • Tag - The tag to differentiate requests.

Item Management :

  • Get User Inventory - Retrieves the user's current inventory of virtual goods.

    • Tag - The tag to differentiate requests.​​

  • Consume Item - Consume uses of a consumable item. When all uses are consumed, it will be removed from the player's inventory.

    • Item Instance ID - Unique instance identifier of the item to be consumed.

    • Consume Count - Number of uses to consume from the item.

  • Purchase Item - Buys a single item with virtual currency.

    • Item ID - Unique identifier of the item to purchase.

    • Price - Price the client expects to pay for the item (in case a new catalog or store was uploaded, with new prices).

    • Virtual Currency - Virtual currency to use to purchase the item.

  • Advanced Purchase Item - Buys a single item with virtual currency. Using advanced features.

    • Item ID - Unique identifier of the item to purchase.

    • Price - Price the client expects to pay for the item (in case a new catalog or store was uploaded, with new prices).

    • Store ID - Store to buy this item through. If not set, prices default to those in the catalog.

    • Virtual Currency - Virtual currency to use to purchase the item.

    • Catalog - Catalog version for the items to be purchased (defaults to most recent version.

    • Catalog Version - Specific Catalog version for the items to be purchased.


Reward Management :

  • Redeem Coupon - Adds the virtual goods associated with the coupon to the user's inventory.

    • Coupon Code - Generated coupon code to redeem.

    • Tag - The tag to differentiate requests.​

  • Redeem Coupon by Version - Adds the virtual goods associated with the coupon to the user's inventory. With Specify the Catalog Version.

    • Coupon Code - Generated coupon code to redeem.

    • Catalog Version - Catalog version of the coupon.

    • Tag - The tag to differentiate requests.​

Conditions

Virtual Currency :

  • On Add User Currency - Triggers when the On Add User Virtual Currency Succeeded.

  • On Add User Currency Error - Triggers when the On Add User Virtual Currency Failed.

  • On Subtract User Currency - Triggers when the On Subtract User Virtual Currency Succeeded.

  • On Subtract User Currency Error - Triggers when the On Subtract User Virtual Currency Failed.

Get User Inventory :

  • On Get User Inventory - Triggers when the On Get User Inventory Succeeded.

  • On Get User Inventory Error - Triggers when the On Get User Inventory Failed.

  • For Each Inventory - Loops through the "Inventory List" if "On Get User Inventory" is successful.


Consume Item :

  • On Consume Success - Triggers when the On Consume Item Succeeded.

  • On Consume Error - Triggers when the On Consume Item Failed.


Purchase Item :

  • On Purchase Success - Triggers when the On Purchase Item Succeeded.

  • On Purchase Error - Triggers when the On Purchase Item Failed.


Redeem Coupon :

  • On Redeem Success - Triggers when the On Redeem Coupon Succeeded.

  • On Redeem Error - Triggers when the On Redeem Coupon Failed.

  • On Coupon Already Redeemed - Triggers when the Coupon Code is already redeemed.

  • On Coupon Code Not Found - Triggers when the Coupon Code is not found.

  • For Each Received - Loops through the "Granted Items List" if "On Redeem Coupon" is successful.

Expressions

Consume Item :

  • conItemInstanceID - Returns the "Item Instance ID". Unique instance identifier of the item with uses consumed.

  • conRemainingUses - Returns the "Remaining Uses". Number of uses remaining on the item.

Purchase Item :

  • purItemID - Returns the "Item ID". Unique identifier for the inventory item, as defined in the catalog.

  • purItemInstanceID - Returns the "Item Instance ID". Unique item identifier for this specific instance of the item.

  • purDate - Returns the "Purchase Date". Timestamp for when this instance was purchased.

  • purCatalogVersion - Returns the "Catalog Version". Catalog version for the inventory item, when this instance was created.

  • purDisplayName - Returns the "Display Name". CatalogItem.DisplayName at the time this item was purchased.

  • purCurrency - Returns the "Unit Currency". Currency type for the cost of the catalog item.

  • purPrice - Returns the "Unit Price". Cost of the catalog item in the given currency.

  • purBundleParent - Returns the "Bundle Parent". Unique identifier for the parent inventory item, as defined in the catalog, for object which were added from a bundle or container.

  • purBundleContent - Returns the "Bundle Content" from an index. Unique items that were awarded when this catalog item was purchased.

  • purBundleContentCount - Returns the "Bundle Content Count". The number of bundle content awarded.


Get User Inventory :: Inventory :

  • curItemID - Returns the "Item ID". Unique identifier for the inventory item, as defined in the catalog.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curItemInstanceID - Returns the "Item Instance ID". Unique item identifier for this specific instance of the item.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curItemClass - Returns the "Item Class". Class name for the inventory item, as defined in the catalog.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curCatalogVersion - Returns the "Catalog Version" for the inventory item, when this instance was created.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curPrice - Returns the "Unit Price". Cost of the catalog item in the given currency.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curCurrency - Returns the "Unit Currency". Currency type for the cost of the catalog item.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curRemainingUses - Returns the "Remaining Uses". Total number of remaining uses, if this is a consumable item.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curDisplayName - Returns the "Display Name". CatalogItem.DisplayName at the time this item was purchased.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curExpiration - Returns the "Expiration". Timestamp for when this instance will expire.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • curPurchaseDate - Returns the "Purchase Date". Timestamp for when this instance was purchased.

    • Index - The Index to lookup from the Inventory. Collected from the latest "Get User Inventory".

  • loopInventory - The LoopIndex from the "For Each Inventory" through the Array of inventory items belonging to the user.​

  • countInventory - The Inventory Count from the Array of inventory items belonging to the user.


Get User Inventory :: Virtual Currency :

  • retCurrencyVal - Returns the "Currency Value". Value of the "Currency" that was inputted.

    • "" - The Currency to load from for the value.

  • retRechargeMax - Returns the "Recharge Max". Maximum value to which the regenerating currency will automatically increment.

    • "" - The Currency to load the value.

  • retRechargeTime - Returns the "Recharge Time". Server timestamp in UTC indicating the next time the virtual currency will be incremented.

    • "" - The Currency to load the value.

  • retSecondsToRecharge - Returns the "Seconds To Recharge". Time remaining (in seconds) before the next recharge increment of the virtual currency.

    • "" - The Currency to load the value.


Redeem Code :

  • redItemID - Returns the "Item ID". Unique identifier for the inventory item, as defined in the catalog.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redItemInstanceID - Returns the "Item Instance ID". Unique item identifier for this specific instance of the item.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redItemClass - Returns the "Item Class". Class name for the inventory item, as defined in the catalog.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redDate - Returns the "Purchase Date". Timestamp for when this instance was purchased.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redExpiration - Returns the "Expiration". Timestamp for when this instance will expire.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redRemainingUses - Returns the "Remaining Uses". Total number of remaining uses, if this is a consumable item.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redCatalogVersion - Returns the "Catalog Version" for the inventory item, when this instance was created.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redDisplayName - Returns the "Display Name". CatalogItem.DisplayName at the time this item was purchased.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redCurrency - Returns the "Unit Currency". Currency type for the cost of the catalog item.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • redPrice - Returns the "Unit Price". Cost of the catalog item in the given currency.

    • Index - The Index to lookup from the Received List. Collected from the latest "Redeem Coupon".

  • loopReceived - The LoopIndex from the "For Each Received" through the Array of received items granted by the "Redeem Coupon".

  • countReceived - The Received Count from the Array of received items granted by the "Redeem Coupon".


Add User Virtual Currency :

  • addVirBalance - Returns the "Balance" of the virtual currency after modification.

  • addVirBalChange - Returns the "Balance Change". Amount added or subtracted from the user's virtual currency.

  • addVirPlayFabID - Returns the "PlayFabID". User currency that was added to.

  • addVirCurrency - Returns the "Virtual Currency". Name of the virtual currency which was modified.


Subtract User Virtual Currency :

  • subVirBalance - Returns the "Balance" of the virtual currency after modification.

  • subVirBalChange - Returns the "Balance Change". Amount added or subtracted from the user's virtual currency.

  • subVirPlayFabID - Returns the "PlayFabID". User currency that was subtracted from.

  • subVirCurrency - Returns the "Virtual Currency". Name of the virtual currency which was modified.


Server Response :

  • ServerResponse - Return the "Server Response" from every request from the PlayFab Server. The server response can also be shown in the "Chrome Developer Tools : Console", if in "debug mode".

Request :

  • Tag - Return the "Tag" of the latest request.

 

Server Setup

The Virtual Currencies with PlayFab is implemented by creating catalogs, a store list within and then virtual currencies for store trade and other transactions. It is easy to setup from the PlayFab Console, it only requires a few steps to set it from the server-side.

Catalogs.png

Step 1 : From the PlayFab Dashboard, select the Economy menu option. By default, the "Catalog" tab will initially show.

Step 2 : Click on the New Catalog button, then fill-up the configuration form.

Store Items.png

Step 3 : Once the catalog is created, press the New Item button.

Step 4 : An item creation configuration form will show, fill-up the necessary settings for the new item.

Currencies.png

Step 5 : Once your catalogs are set, you will need to setup your virtual currencies. Click on the Currency tab.

Step 6 : Finally, add and configure your new virtual currency that will be used on your app's virtual store.

Once you are done with the server configuration. You can then proceed into using the Virtual Currencies addon in your game application.

 

Remember to enable the Virtual Currencies options and features from the PlayFab Settings > API Features and PlayFab Settings > Client Profile Options. And then, match the server's Client Profile Options with the client-side by configuring the settings on the PlayFab API addon.

After that, you're all set up and you may proceed in developing your game's virtual store design.

 

Title Manager

The Virtual Currencies addon already can retrieve the store listing. 
The
Title Manager addon, as the game manager, it can retrieve the entire catalog with the store listing.
It can do other game management features too.

 

Real Currencies

Virtual Currencies addon only handles virtual currencies and virtual products.

For real-life monetary value, use the Real Currencies addon where it accepts real currencies like USD.

Game Project

Sample Setup Project

Specifications

  • Instructions - The sample project has comments and instructions on how to use the addon and its features.

  • A.C.E. Coverage - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks to a better use of the addon and of the event-sheet system alongside it.

Supporters

Only

 

Easy Game Project

Sample Setup Project

Specifications

  • Instructions - The sample project has comments and instructions on how to use the addon and its features.

  • A.C.E. Coverage - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks to a better use of the addon and of the event-sheet system alongside it.

Supporters

Only

Get the tools

for your pro games!

Constuct Master Collection - Itch.io
Constuct Master Collection - Discord
Constuct Master Collection - Construct 3

© Construct Master Collection 2020 • All rights reserved

Contact Information:

Expressions - 2