EOS Interfaces
Entitlements
warning
Requires EOSCore 2.2.0 and later.
The Online Subsystem implements IOnlineEntitlements with EOS Ecom. An entitlement is something the player owns on the Epic Games Store, for example the game or a DLC.
Use it through the Online Subsystem with GetEntitlementsInterface(). There are no Blueprint nodes for the Entitlements interface. In Blueprint, use EOS_Ecom_QueryEntitlements and the other Ecom functions, see Ecom.
Requirements
- The player is logged in with an Epic Account (Auth interface). A Connect login alone is not enough, QueryEntitlements then fails with
Entitlements need a user logged in with an Epic account. - Your product is set up for the Epic Games Store, with catalog items and offers in the Developer Portal.
Functions
| Entitlements function | EOS function | Callback |
|---|---|---|
| QueryEntitlements | EOS_Ecom_QueryEntitlements, redeemed entitlements included | OnQueryEntitlementsComplete |
| GetAllEntitlements | Reads the entitlements from the last query | None |
| GetEntitlement | Finds an entitlement by its entitlement id | None |
| GetItemEntitlement | Finds an entitlement by its catalog item id | None |
Namespace in QueryEntitlements is passed to EOS as the catalog namespace override. Leave it empty to use the catalog of your sandbox. GetAllEntitlements with a namespace only returns the entitlements queried with that namespace. An empty namespace returns all of them.
Each FOnlineEntitlement has:
| Field | Value |
|---|---|
| Id | Entitlement id |
| Name | Entitlement name |
| ItemId | Catalog item id |
| Namespace | The namespace used in the query |
| Status | Active, or Redeemed for a redeemed entitlement |
| ConsumedCount | 1 when redeemed, otherwise 0 |
| EndDate | ISO 8601 date when the entitlement ends. Empty if it does not end |
Example
#include "OnlineSubsystem.h"
#include "OnlineSubsystemUtils.h"
#include "Interfaces/OnlineEntitlementsInterface.h"
#include "Interfaces/OnlineIdentityInterface.h"
void AMyPlayerController::CheckDLC()
{
IOnlineSubsystem* Subsystem = Online::GetSubsystem(GetWorld(), TEXT("EOSCore"));
IOnlineEntitlementsPtr Entitlements = Subsystem ? Subsystem->GetEntitlementsInterface() : nullptr;
FUniqueNetIdPtr UserId = Subsystem ? Subsystem->GetIdentityInterface()->GetUniquePlayerId(0) : nullptr;
if (!Entitlements.IsValid() || !UserId.IsValid())
{
return;
}
Entitlements->AddOnQueryEntitlementsCompleteDelegate_Handle(FOnQueryEntitlementsCompleteDelegate::CreateUObject(this, &AMyPlayerController::OnQueryEntitlementsComplete));
Entitlements->QueryEntitlements(*UserId, FString());
}
void AMyPlayerController::OnQueryEntitlementsComplete(bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Namespace, const FString& Error)
{
IOnlineEntitlementsPtr Entitlements = Online::GetSubsystem(GetWorld(), TEXT("EOSCore"))->GetEntitlementsInterface();
if (bWasSuccessful && Entitlements->GetItemEntitlement(UserId, TEXT("<catalog item id of the DLC>")).IsValid())
{
// The player owns the DLC
}
}
Limits
- Page in QueryEntitlements is ignored. All entitlements are returned.
bIsConsumableis always false. UseEOS_Ecom_RedeemEntitlementsto redeem consumable entitlements.