Entitlements

Entitlements lets the player keep track of purchases they have done.

Some distributors requires the player to be able to see their previous purchase history and this is where Entitlements come in.

Entitlement In-game Implementation

Get Single Entitlement

When getting a single entitlement, you can use the Status field to check where the purchase is in it's current stage.

  1. canceled means that the purchase was canceled either by the player or an issue was encountered.

  2. pending means that the purchase is currently still being processed, at this time it would be smart to invoke the method again to check for updates. It would also be a good idea to limit number or rate of attempts to avoid spamming the function.

  3. active means that the purcahse has completed.

string entitlementID = "";
LootLockerSDKManager.GetSingleEntitlementHistory(entitlementID, (response)=>
{
    if(!reponse.success)
    {
        Debug.Log(response.errorData.ToString());
        return;
    }

    if(response.Status == LootLockerEntitlementHistoryListingStatus.canceled)
    {
        //canceled or issue encountered.
        Debug.Log(response.errorData.ToString());
        return;
    }

    if(response.Status == LootLockerEntitlementHistoryListingStatus.pending)
    {
        //retry the process
    }

    if(response.Status == LootLockerSDKManager.GetSingleEntitlementHistory.active)
    {
        //Purchase successful, handle the expected outcome.
    }
});

List Entitlements

Each entitlement in the response has multiple entries of information, such as Type, Store, and the Rewards and Items which were given to the player.

int count = 10;
string after = "";
LootLockerSDKManager.ListEntitlements(count,after,(response) => {
    if (!response.success) {
        Debug.Log("Could not get entitlements");
        return;
    }
    //Handle entitlement list
});

Last updated