PlayFab Backend Integration for Mobile Game

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
PlayFab Backend Integration for Mobile Game
Medium
~1-2 weeks
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

PlayFab Backend Integration for Mobile Games

PlayFab—Microsoft's BaaS (Backend as a Service) purpose-built for games. Provides game backend out of box: authentication, inventory, currency, shop, leaderboards, matchmaking, push notifications, server logic via Cloud Script. For mobile games without backend developer, PlayFab covers 80% of needs.

Main risk isn't technical. PlayFab provides tools, but if data architecture is wrong (Title Data naming, Player Data structure, Catalog schema), redesign later is painful. Invest time upfront.

SDK Initialization

using PlayFab;
using PlayFab.ClientModels;

public class PlayFabManager : MonoBehaviour
{
    public static PlayFabManager Instance { get; private set; }
    public string PlayFabId { get; private set; }

    void Awake()
    {
        PlayFabSettings.staticSettings.TitleId = "YOUR_TITLE_ID";
    }

    // Anonymous auth via Device ID
    public void LoginAnonymous(Action onSuccess, Action<string> onError)
    {
#if UNITY_IOS
        PlayFabClientAPI.LoginWithIOSDeviceID(new LoginWithIOSDeviceIDRequest
        {
            DeviceId = SystemInfo.deviceUniqueIdentifier,
            CreateAccount = true,
            InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
            {
                GetPlayerProfile = true,
                GetUserInventory = true,
                GetUserVirtualCurrency = true
            }
        }, result => {
            PlayFabId = result.PlayFabId;
            ApplyPlayerData(result.InfoResultPayload);
            onSuccess?.Invoke();
        }, error => onError?.Invoke(error.GenerateErrorReport()));
#elif UNITY_ANDROID
        PlayFabClientAPI.LoginWithAndroidDeviceID(new LoginWithAndroidDeviceIDRequest
        {
            AndroidDeviceId = SystemInfo.deviceUniqueIdentifier,
            CreateAccount = true,
            InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
            {
                GetPlayerProfile = true,
                GetUserInventory = true,
                GetUserVirtualCurrency = true
            }
        }, result => {
            PlayFabId = result.PlayFabId;
            ApplyPlayerData(result.InfoResultPayload);
            onSuccess?.Invoke();
        }, error => onError?.Invoke(error.GenerateErrorReport()));
#endif
    }
}

InfoRequestParameters at login—important optimization: get inventory and currency in one request instead of three separate calls after auth.

Inventory and Catalog

PlayFab Catalog defines all game items. Each item (CatalogItem) has ID, virtual currency prices, stack type, and custom data:

{
  "ItemId": "sword_legendary",
  "DisplayName": "Legendary Sword",
  "VirtualCurrencyPrices": { "GO": 500 },
  "Consumable": { "UsageCount": null },
  "CustomData": "{\"damage\": 150, \"speed\": 0.8, \"rarity\": \"legendary\"}"
}

Purchase item from shop:

PlayFabClientAPI.PurchaseItem(new PurchaseItemRequest
{
    ItemId = "sword_legendary",
    VirtualCurrency = "GO",  // Gold
    Price = 500,
    CatalogVersion = "v1"
}, result => {
    // result.Items – added items
    InventoryManager.Instance.RefreshFromPlayFab(result.Items);
}, error => Debug.LogError(error.GenerateErrorReport()));

PlayFab auto-deducts currency and adds item to inventory—transaction is atomic server-side.

Virtual Currencies

PlayFab supports up to 10 currencies per Title. Set up in Game Manager: GO (Gold), GE (Gems), EN (Energy). Payout:

// Via Cloud Script – only server can grant currency
// Client calls function:
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
{
    FunctionName = "AddDailyReward",
    FunctionParameter = new { rewardType = "daily_login" }
}, result => {
    var newBalance = JsonUtility.FromJson<CurrencyResult>(result.FunctionResult.ToString());
    CurrencyManager.Instance.UpdateBalance(newBalance);
}, error => { });

Direct client-side grant (AddUserVirtualCurrency) possible but disabled in production—otherwise anyone can grant themselves gold via request intercept.

Player Data and Title Data

Player Data — specific player data (progress, settings, saves):

// Save progress
PlayFabClientAPI.UpdateUserData(new UpdateUserDataRequest
{
    Data = new Dictionary<string, string>
    {
        { "current_level", currentLevel.ToString() },
        { "inventory_preset", JsonUtility.ToJson(inventoryPreset) }
    },
    Permission = UserDataPermission.Public  // visible to other players (for profile)
}, null, null);

Title Data — global game data, same for all (balance tables, event config, localization strings). Cached client-side:

PlayFabClientAPI.GetTitleData(new GetTitleDataRequest
{
    Keys = new List<string> { "balance_config", "event_schedule" }
}, result => {
    var balanceJson = result.Data["balance_config"];
    BalanceManager.Instance.ApplyConfig(balanceJson);
}, null);

Cloud Script: Server Logic

PlayFab Cloud Script—server JavaScript functions. Critical operations (reward grant, craft processing, purchase verification) must go through Cloud Script:

// Handlers.js on PlayFab
handlers.CompleteDailyQuest = function(args, context) {
    var questId = args.questId;
    var playerId = context.playerId;

    // Check quest actually done
    var playerData = server.GetUserData({ PlayFabId: playerId, Keys: ["daily_quests"] });
    var quests = JSON.parse(playerData.Data["daily_quests"].Value);
    var quest = quests.find(q => q.id === questId);

    if (!quest || !quest.isCompleted || quest.rewardClaimed) {
        return { success: false, error: "invalid_quest_state" };
    }

    // Grant reward
    server.AddUserVirtualCurrency({
        PlayFabId: playerId,
        VirtualCurrency: "GO",
        Amount: quest.reward
    });

    // Mark as granted
    quest.rewardClaimed = true;
    server.UpdateUserData({
        PlayFabId: playerId,
        Data: { "daily_quests": JSON.stringify(quests) }
    });

    return { success: true, reward: quest.reward };
};

Matchmaking

PlayFab Matchmaking (Multiplayer Servers) creates search tickets with rules:

PlayFabMultiplayerAPI.CreateMatchmakingTicket(new CreateMatchmakingTicketRequest
{
    Creator = new MatchmakingPlayer
    {
        Entity = new EntityKey { Id = entityId, Type = "title_player_account" },
        Attributes = new MatchmakingPlayerAttributes
        {
            DataObject = new { rating = playerRating, region = playerRegion }
        }
    },
    GiveUpAfterSeconds = 30,
    QueueName = "ranked_1v1"
}, result => {
    StartPollingTicket(result.TicketId);
}, error => { });

Matchmaking rules (skill range, region, latency) configured in Game Manager without code changes.

What's Included

  • PlayFab Title setup: currencies, Catalog, Title Data
  • SDK integration (Unity / iOS / Android)
  • Authentication: Device ID, Email, platform accounts (Google Play / Game Center)
  • Player Data: save and load progress
  • Inventory and shop with virtual currencies
  • Cloud Script for critical ops (rewards, craft, quests)
  • Leaderboards and stats
  • Push notifications via PlayFab

Timeline

Basic integration (auth + inventory + leaderboards): 5–7 days. Full game backend (quests, craft, shop, matchmaking): 3–6 weeks. Cost calculated individually.