The users can buy Virtual Items either individually or in packs. After a virtual item is purchased it will be added to the user's inventory. You can use the PLAY Dev Dashboard to create new store offers and virtual items.
Each store offer can contain one or more virtual items to sell. Price info data is also part of the store offer. It is also possible to sell virtual items without creating store offers.
StoreOffer
id (string): Unique id or the store offer.
name (string): Name of the store offer.
description (string): Description of the virtual item.
appIds (List<string>): List of project id where your store offer can be accessed.
createdAt (long): Date and time of the store offer creation.
updatedAt (long): Date and time of the last update on the store offer.
createdBy (string): User ID of the creator of the store offer.
updatedBy (string): User ID of the last person who updated the store offer.
tags (List<string>): List of tags to filter the store offers.
time (TimeInfo): Contains the time infos for your store offer.
itemIds (List<string>): List of items available in your store offer
prices (List<PriceInfo>): List of prices defined for this store offer. Used to process transaction with the user's currencies.
properties (List<Property>): List of properties you can store in json format to retrieve with the store offer.
Get Store Offers
Buy Virtual Items and Store offers
Store
Integration Guide
Unity
Unity integration
Introduction
The users can buy Virtual Items either individually or in packs. After a virtual item is purchased it will be added to the user's inventory. You can use the PLAY Dev Dashboard to create new store offers and virtual items.
Each store offer can contain one or more virtual items to sell. Price info data is also part of the store offer. It is also possible to sell virtual items without creating store offers.
StoreOffer
id (string): Unique id or the store offer.
name (string): Name of the store offer.
description (string): Description of the virtual item.
appIds (List<string>): List of project id where your store offer can be accessed.
createdAt (long): Date and time of the store offer creation.
updatedAt (long): Date and time of the last update on the store offer.
createdBy (string): User ID of the creator of the store offer.
updatedBy (string): User ID of the last person who updated the store offer.
tags (List<string>): List of tags to filter the store offers.
time (TimeInfo): Contains the time infos for your store offer.
itemIds (List<string>): List of items available in your store offer
prices (List<PriceInfo>): List of prices defined for this store offer. Used to process transaction with the user's currencies.
properties (List<Property>): List of properties you can store in json format to retrieve with the store offer.
Buy Virtual Items and Store offers
In case the virtual item contains prices information
usingSystem.Collections.Generic;usingUnityEngine;usingRGN.Modules.Store;usingRGN.Modules.Currency;usingRGN.Modules.Inventory;publicclassStoreExamples:MonoBehaviour{publicasyncvoidBuyStoreOfferAsync() {PurchaseResult purchaseResult =awaitStoreModule.I.BuyStoreOfferAsync("storeOfferId"); // purchaseResult Returns the purchased items and updated currenciesList<Currency> updatedCurrencies =purchaseResult.updatedCurrencies;List<InventoryItemData> purchasedItems =purchaseResult.items; }}
Get store offer
usingSystem.Collections.Generic;usingUnityEngine;usingRGN.Modules.Store;publicclassStoreExamples:MonoBehaviour{publicasyncvoidGetStoreOfferAsync() { // Get the first 10 offerList<StoreOffer> offers =awaitStoreModule.I.GetWithVirtualItemsDataForCurrentAppAsync(10); // Pick the first returned offer for log purposesStoreOffer firstStoreOffer =offers[0];Debug.Log($"Store offer id : {firstStoreOffer.id}"); // Log the virtuals items name for this offerforeach (var virtualItem infirstStoreOffer.virtualItems) {Debug.Log($"Virtual item name : {virtualItem.name}"); } }}
Buy Virtual Items NFT
In order to purchase NFTs, there is some additional check you will need to do to make sure the user has all the requirements.
Here's an example: