QuestEngine SDK for Unreal Engine 5

The official Unreal Engine plugin for QuestEngine: player accounts, wallets and items, a store with App Store and Google Play receipt checks, missions, live events, leaderboards, levels, friends, an inbox and remote config.

It works from Blueprint (async nodes with On Success / On Failure pins) and from C++ (UQuestEngineSubsystem). It uses the engine's own HTTP and JSON modules and has no other dependencies.

Contents

  1. Install
  2. Project Settings
  3. Blueprint quickstart
  4. C++ quickstart
  5. Responses and JSON
  6. Sessions
  7. Errors
  8. In-app purchases
  9. Remote config
  10. Reference

Install

  1. Download https://questengine.eu/sdk/questengine-unreal.zip and unzip it.

  2. Copy its QuestEngine folder into your project's Plugins/ folder (create Plugins/ next to your .uproject if it does not exist), so you have YourGame/Plugins/QuestEngine/QuestEngine.uplugin.

    Alternatively, copy sdk/unreal/QuestEngine from the QuestEngine repository.

  3. C++ projects: right-click the .uproject and choose Generate Visual Studio project files (on macOS, Generate Xcode Project), then build the editor target.

  4. Open the project, go to Edit > Plugins, find QuestEngine under Online, check that it is enabled, and restart the editor if asked.

The plugin ships as source code, so the engine compiles it with your project. A Blueprint-only project needs a C++ toolchain for that (Visual Studio on Windows, Xcode on macOS); the editor offers to build the plugin the first time it opens the project. You can also turn the project into a C++ project with Tools > New C++ Class.

To call the SDK from C++, add the module to your game's Build.cs:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "QuestEngine" });

Project Settings

Edit > Project Settings > Plugins > QuestEngine:

Setting Default Meaning
Base Url https://questengine.eu/api/v1 API address, including /api/v1.
Client Key (empty) The game's client key, qe_pk_…, from the console. It is public and ships in the build.
Request Timeout Seconds 30 A request without a response after this time fails with network_error.
Auto Refresh Session on Renews the session token once half of its lifetime has passed.
Log Requests off Logs each request and its result to LogQuestEngine (bodies at Verbose). Tokens, passwords and receipts are never logged.

The values are saved in Config/DefaultGame.ini:

[/Script/QuestEngine.QuestEngineSettings]
BaseUrl=https://questengine.eu/api/v1
ClientKey=qe_pk_your_client_key

Configure(BaseUrl, ClientKey) overrides the first two at runtime, for example to switch between a staging and a live game.

Never put the server key (qe_sk_…) in a game. The /server/* endpoints that use it are for your own backend; the SDK refuses those paths with server_only.

Blueprint quickstart

With the client key in Project Settings, build this chain in your Game Instance, Game Mode or first level Blueprint:

  1. Event BeginPlay → QuestEngine Login With Device (leave Display Name empty, or pass a name for new players).
  2. From On Success → QuestEngine Get Wallet.
  3. From the wallet's On Success: drag off Response, choose Break Quest Engine Response (or right-click the pin and Split Struct Pin), and pass Data Json to Get JSON Array Items (Path empty: the wallet is an array).
  4. For Each Loop over the items. For each item, Get JSON String (Path currency) and Get JSON Int (Path balance), then Print String.
  5. From both On Failure pins: Break Quest Engine Response → Print String with Error Code and Error Message.

To set the URL and key from Blueprint instead, call Get Quest Engine Subsystem → Configure before the first QuestEngine node.

Every QuestEngine node fires exactly one of its two pins, on the game thread. The node's plain exec pin continues right away, before the result is in. If the game instance shuts down first, neither pin fires.

Useful subsystem nodes (from Get Quest Engine Subsystem): Is Signed In, Get Player Id, Sign Out, Get Cached Remote Config, and the events On Signed In and On Session Expired (use Assign On Session Expired to show your login screen).

C++ quickstart

#include "Engine/GameInstance.h"
#include "QuestEngineSubsystem.h"

// For example in an actor's BeginPlay:
UQuestEngineSubsystem* QE = GetGameInstance()->GetSubsystem<UQuestEngineSubsystem>();
QE->Configure(TEXT("https://questengine.eu/api/v1"), TEXT("qe_pk_…"));
QE->LoginWithDevice(FQuestEngineResponseDelegate::CreateLambda(
    [QE](const FQuestEngineResponse& Response)
    {
        if (Response.bOk)
        {
            QE->Get(TEXT("me/wallet"), FQuestEngineResponseDelegate());
        }
    }));

Callbacks may be unbound (as in the wallet call above: fire and forget). They run on the game thread and never after the game instance has shut down, so capturing the subsystem pointer is safe. Capture other objects with TWeakObjectPtr, or bind with CreateUObject / CreateWeakLambda:

QE->GetWallet(FQuestEngineResponseDelegate::CreateWeakLambda(this, [this](const FQuestEngineResponse& Response)
{
    if (!Response.bOk)
    {
        UE_LOG(LogTemp, Warning, TEXT("Wallet failed: %s"), *Response.ToString());
        return;
    }
    for (const TSharedPtr<FJsonValue>& Entry : Response.GetDataArray())
    {
        const TSharedPtr<FJsonObject> Wallet = Entry->AsObject();
        UE_LOG(LogTemp, Log, TEXT("%s: %d"), *Wallet->GetStringField(TEXT("currency")), static_cast<int32>(Wallet->GetNumberField(TEXT("balance"))));
    }
}));

The typed methods follow one rule: required arguments, then the callback, then optional arguments. For example UseItem(TEXT("hammer"), Callback, 2) or GetLeaderboard(TEXT("weekly"), Callback, 20).

Any endpoint is also available through the generic calls; paths are relative to the base URL:

QE->Request(TEXT("POST"), TEXT("friends"), TEXT("{\"friend_code\":\"AB12CD\"}"), Callback);
QE->Get(TEXT("events/summer/standings?limit=10"), Callback);

Responses and JSON

Every call ends with an FQuestEngineResponse:

Field Meaning
bOk True on success (HTTP 2xx, and 304 for remote config).
StatusCode HTTP status; 0 when there was no response.
ErrorCode Stable code such as insufficient_funds. Empty on success.
ErrorMessage Text for developers and logs. Don't show it to players or branch on it.
ErrorDetailsJson The error's details as JSON, e.g. each invalid field for validation_failed.
DataJson The response's data value as JSON text: an object, an array or null.

C++ also gets Data (the parsed TSharedPtr<FJsonValue>), ErrorDetails, HttpResponse (headers), and helpers: GetDataObject(), GetDataArray(), Find(Path), GetString(Path, Default), GetInt(Path, Default) (int64), GetNumber, GetBool, IsError(Code) and ToString().

Paths are dotted: player.display_name, wallet.0.balance (or wallet[0].balance), entries.-1 for the last item. An empty path means the whole value. Keys that contain dots, such as a cloud-save key settings.audio, still resolve.

Blueprint nodes (category QuestEngine | JSON), each taking the JSON text and a path:

Node Returns
Get JSON String / Int / Int64 / Float / Bool The value, and Found (false when the path is missing or has another type).
Get JSON Array Length Item count, 0 when missing.
Get JSON Array Items Each item as JSON text, for a For Each loop.
Get JSON Object Keys The keys of an object (remote config, cloud saves, stats).
Get JSON At Path Any value as JSON text, to pass to other JSON nodes.
Has JSON Path True when the path exists and is not null.
Quote JSON String, Make JSON Object (Strings) Build request bodies for the QuestEngine Request node.
Is QuestEngine Error True when the response failed with a given code.

Each node parses the JSON it is given. For lists, take Get JSON Array Items once and read fields from each small item rather than indexing into the whole response repeatedly.

Rewards everywhere use one shape, [{"type": "currency", "code": "coins", "quantity": 100}, ...]; opened chests include contents.

Sessions

The save slot is ordinary save data on the device. Treat the save folder as private to the player.

Errors

Branch on ErrorCode, never on the message. The server may add codes, so keep a default branch.

Codes raised by the SDK:

Code When
network_error No response: offline, DNS or TLS failure, or timeout. StatusCode is 0. Purchases and receipt checks retry once by themselves.
invalid_response The server's answer is not QuestEngine JSON (e.g. a captive portal page).
http_error / server_error An HTTP 4xx / 5xx without a QuestEngine error body.
not_configured No base URL or client key.
unauthenticated Nobody is signed in (status 401, no request sent).
not_modified 304 for a request that sent its own If-None-Match.
server_only A /server/* path: those need the secret server key and belong on your backend.
validation_failed Also raised locally when a MetadataJson / MetaJson argument is not valid JSON.
no_game_instance A Blueprint node ran without a game instance (e.g. in an editor utility).

Common server codes:

HTTP Codes
401 invalid_game_key, unauthenticated, invalid_credentials, invalid_token (Facebook token on friends import)
403 game_disabled, player_banned (details: reason, until), auth_method_disabled, server_only, stat_not_writable, test_purchases_disabled
404 not_found, player_not_found, unknown_product
409 insufficient_funds (details: currency, balance, required), not_enough_energy, not_enough_items, item_locked, item_not_usable, level_locked, attempt_finished, offer_unavailable, offer_locked, purchase_limit_reached, real_money_offer, transaction_already_used, mission_incomplete, already_claimed, nothing_to_claim, version_conflict (details: current version and value), email_taken, identity_in_use, last_identity, too_many_keys
413 value_too_large
422 validation_failed (details list each field), invalid_receipt, score_out_of_range, unknown_stat
429 rate_limited: 300 requests per minute per player, 30 sign-ins per minute per IP
502 / 503 store_unavailable, iap_not_configured, facebook_not_configured

In-app purchases

Virtual offers (paid with game currency): QuestEngine Purchase Offer / PurchaseOffer(OfferCode). It spends the currency and grants the contents in one step. The SDK sends an Idempotency-Key (a new GUID per call) and retries once on network_error with the same key, so a retry never buys twice. If you retry later yourself, generate the key with FGuid::NewGuid(), pass it, and reuse it for the retry.

Real money: buy through the platform store with your purchase plugin (StoreKit on iOS, Google Play Billing on Android), then pass the platform's receipt to QuestEngine Verify Purchase / VerifyPurchase. QuestEngine checks it with the store, grants the linked offer's contents once per transaction and acknowledges Google purchases:

Platform Product Id Receipt Transaction Id
Apple optional StoreKit 2 signed transaction (jwsRepresentation) or the transaction ID instead of a receipt
Google required (the Play product ID) the purchase token (not needed)
Test the offer code or product ID (not needed) optional
QE->VerifyApplePurchase(SignedTransaction, Callback);
QE->VerifyGooglePurchase(ProductId, PurchaseToken, Callback);
QE->VerifyPurchase(EQuestEnginePurchasePlatform::Apple, FString(), FString(), Callback, TransactionId);

Finish (iOS) or consume (Android) the transaction in the store only after the verification succeeds, so an interrupted check can be repeated on the next start; replays of a verified transaction return the original purchase. On success, data.purchase holds the purchase with its rewards, and data.wallet the new balances.

While the game's IAP mode is sandbox, VerifyTestPurchase(OfferCode) (platform Test) grants an offer without a store, for testing. Refunds are handled on the server through App Store and Google Play notifications.

Remote config

QuestEngine Get Remote Config / GetRemoteConfig returns all active values as one object: read them with Get JSON String (or Int, Float, Bool) and the key as the path, or list them with Get JSON Object Keys.

The SDK keeps the last config and its ETag in the save slot and sends If-None-Match. When nothing changed, the server answers 304 and you get the cached values (bOk true, StatusCode 304). Get Cached Remote Config returns the last config immediately, also offline, so the game can start with it while the request runs. No player session is needed.

Reference

All C++ methods are on UQuestEngineSubsystem and take a FQuestEngineResponseDelegate callback (Cb below; optional arguments come after it). Each call has a Blueprint node named QuestEngine + the method name, e.g. QuestEngine Get Wallet. C++ only: Get/Post/Put/Patch/Delete (use QuestEngine Request), VerifyApplePurchase/VerifyGooglePurchase/VerifyTestPurchase (use QuestEngine Verify Purchase) and SetPlayerDataValue (use QuestEngine Set Player Data).

C++ Endpoint Notes
Configure(BaseUrl, ClientKey) Blueprint-callable; overrides Project Settings
IsConfigured(), IsSignedIn(), GetPlayerId(), GetDeviceId(), GetSessionExpiresAt(), GetBaseUrl(), GetCachedRemoteConfig() Blueprint-pure
SignOut() Local only
OnSignedIn, OnSessionExpired Blueprint-assignable events
Request(Verb, Path, BodyJson, Cb, ExtraHeaders), Get, Post, Put, Patch, Delete any Node: QuestEngine Request
LoginWithDevice(Cb, DisplayName) POST /auth/device
LoginWithCustomId(CustomId, Cb, bCreate, DisplayName) POST /auth/custom
RegisterEmail(Email, Password, Cb, DisplayName) POST /auth/email/register
LoginEmail(Email, Password, Cb) POST /auth/email/login
RefreshSession(Cb) POST /auth/refresh Automatic by default
Logout(Cb) POST /auth/logout Also signs out locally
LinkLogin(Provider, Identifier, Cb, Password), UnlinkLogin(Provider, Cb) POST /auth/link, DELETE /auth/link/{provider}
GetMe(Cb), UpdateMe(DisplayName, Cb, AvatarUrl) GET /me, PATCH /me Empty fields stay unchanged
GetPlayer(IdOrFriendCode, Cb) GET /players/{player} Public profile
GetPlayerData(Cb, Keys) GET /me/data Cloud save
SetPlayerData(Key, ValueJson, Cb, ExpectedVersion, bPublic), SetPlayerDataValue(...) PUT /me/data/{key} Text that is not JSON is stored as a string; version -1 = no check
DeletePlayerData(Key, Cb) DELETE /me/data/{key}
GetStats(Cb), SubmitStats(Stats, Cb) GET, POST /me/stats Stats: code to value
GetCurrencies(Cb), GetWallet(Cb), GetTransactions(Cb, Limit) /currencies, /me/wallet, /me/transactions
GetItems(Cb, Kind, Category), GetInventory(Cb) /items, /me/inventory
UseItem(ItemCode, Cb, Quantity) POST /me/inventory/{code}/use
GetStore(Cb), GetPurchases(Cb) /store, /me/purchases
PurchaseOffer(OfferCode, Cb, IdempotencyKey) POST /store/{code}/purchase Idempotency-Key, one retry
VerifyPurchase(Platform, ProductId, Receipt, Cb, TransactionId), VerifyApplePurchase, VerifyGooglePurchase, VerifyTestPurchase POST /purchases/verify One retry
GetMissions(Cb), ClaimMission(Code, Cb) /missions, POST /missions/{code}/claim
GetEvents(Cb), GetEvent(Code, Cb), JoinEvent(Code, Cb), ClaimEvent(Code, Cb, Tier), GetEventStandings(Code, Cb, Limit) /events/... Tier -1 = all reached tiers
GetLeaderboards(Cb), GetLeaderboard(Code, Cb, Limit, Offset, bPreviousPeriod), GetLeaderboardAroundMe(Code, Cb, Range, bPreviousPeriod), GetFriendsLeaderboard(Code, Cb, bPreviousPeriod) /leaderboards/...
SubmitScore(Code, Score, Cb, MetadataJson) POST /leaderboards/{code}/scores
GetLevels(Cb, bIncludeData), GetLevel(Number, Cb) /levels, /levels/{number}
StartLevel(Number, Cb) POST /levels/{number}/start Keep data.attempt.id
FinishLevel(AttemptId, bWon, Score, Stars, Cb, DurationSeconds, MetaJson) POST /level-attempts/{id}/finish -1 leaves Score, Stars or Duration out
GetFriends(Cb), SendFriendRequest(CodeOrPlayerId, Cb), AcceptFriendRequest(Id, Cb), DeclineFriendRequest(Id, Cb), RemoveFriend(PlayerId, Cb), ImportFacebookFriends(AccessToken, Cb) /friends/...
GetInbox(Cb), MarkInboxMessageRead(Id, Cb), ClaimInboxMessage(Id, Cb), DeleteInboxMessage(Id, Cb) /inbox/...
GetServerTime(Cb) GET /time Use instead of the device clock
GetRemoteConfig(Cb) GET /config ETag cache

Times in responses are UTC, ISO 8601. Daily periods reset at 00:00 UTC, weekly ones on Monday, monthly ones on the 1st.