Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Runtime/Client/LootLockerEndPoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public class LootLockerEndPoints
public static EndPointClass purchaseCatalogItem = new EndPointClass("purchase", LootLockerHTTPMethod.POST);
public static EndPointClass redeemAppleAppStorePurchase = new EndPointClass("store/apple/redeem", LootLockerHTTPMethod.POST);
public static EndPointClass redeemGooglePlayStorePurchase = new EndPointClass("store/google/redeem", LootLockerHTTPMethod.POST);
public static EndPointClass redeemEpicStorePurchase = new EndPointClass("store/epic/redeem", LootLockerHTTPMethod.POST);

public static EndPointClass beginSteamPurchaseRedemption = new EndPointClass("store/steam/redeem/begin", LootLockerHTTPMethod.POST);
public static EndPointClass querySteamPurchaseRedemptionStatus = new EndPointClass("store/steam/redeem/query", LootLockerHTTPMethod.POST);
Expand Down
54 changes: 54 additions & 0 deletions Runtime/Game/LootLockerSDKManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5831,6 +5831,60 @@ public static void RedeemGooglePlayStorePurchaseForClass(string productId, strin
LootLockerServerRequest.CallAPI(forPlayerWithUlid, LootLockerEndPoints.redeemGooglePlayStorePurchase.endPoint, LootLockerEndPoints.redeemGooglePlayStorePurchase.httpMethod, body, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
}

/// <summary>
/// Redeem a purchase that was made successfully towards the Epic Store for the current player
/// </summary>
/// <param name="accountId">The Epic account id of the account that this purchase was made for</param>
/// <param name="bearerToken">This is the token from epic used to allow the LootLocker backend to verify ownership of the specified entitlements. This is sometimes referred to as the Server Auth Ticket or Auth Token depending on your Epic integration.</param>
/// <param name="entitlementIds">The ids of the purchased entitlements that you wish to redeem</param>
/// <param name="sandboxId">The Sandbox Id configured for the game making the purchase (this is the sandbox id from your epic online service configuration)</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional: Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void RedeemEpicStorePurchaseForPlayer(string accountId, string bearerToken, List<string> entitlementIds, string sandboxId, Action<LootLockerResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>(forPlayerWithUlid));
return;
}
var body = LootLockerJson.SerializeObject(new LootLockerRedeemEpicStorePurchaseForPlayerRequest()
{
account_id = accountId,
bearer_token = bearerToken,
entitlement_ids = entitlementIds,
sandbox_id = sandboxId
});
LootLockerServerRequest.CallAPI(forPlayerWithUlid, LootLockerEndPoints.redeemEpicStorePurchase.endPoint, LootLockerEndPoints.redeemEpicStorePurchase.httpMethod, body, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
}

/// <summary>
/// Redeem a purchase that was made successfully towards the Epic Store for a class that the current player owns
/// </summary>
/// <param name="accountId">The Epic account id of the account that this purchase was made for</param>
/// <param name="bearerToken">This is the token from epic used to allow the LootLocker backend to verify ownership of the specified entitlements. This is sometimes referred to as the Server Auth Ticket or Auth Token depending on your Epic integration.</param>
/// <param name="entitlementIds">The ids of the purchased entitlements that you wish to redeem</param>
/// <param name="sandboxId">The Sandbox Id configured for the game making the purchase (this is the sandbox id from your epic online service configuration)</param>
/// <param name="classId">The id of the class to redeem this purchase for</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional: Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void RedeemEpicStorePurchaseForClass(string accountId, string bearerToken, List<string> entitlementIds, string sandboxId, int classId, Action<LootLockerResponse> onComplete, string forPlayerWithUlid = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should class ID here be player class ID?
Class ID would be the one viewable in the console, player class ID would be the class belonging to this player.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right, but I can't find any other place that we've named it such. Neither in api dog nor in the SDKs...

{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>(forPlayerWithUlid));
return;
}
var body = LootLockerJson.SerializeObject(new LootLockerRedeemEpicStorePurchaseForClassRequest()
{
account_id = accountId,
bearer_token = bearerToken,
entitlement_ids = entitlementIds,
class_id = classId,
sandbox_id = sandboxId
});
LootLockerServerRequest.CallAPI(forPlayerWithUlid, LootLockerEndPoints.redeemEpicStorePurchase.endPoint, LootLockerEndPoints.redeemEpicStorePurchase.httpMethod, body, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
}

/// <summary>
/// Begin a Steam purchase with the given settings that when finalized will redeem the specified catalog item
///
Expand Down
35 changes: 35 additions & 0 deletions Runtime/Game/Requests/PurchaseRequest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using LootLocker.Requests;
using System;
using LootLocker.LootLockerEnums;
using System.Collections.Generic;

#if LOOTLOCKER_USE_NEWTONSOFTJSON
using Newtonsoft.Json;
#else
Expand Down Expand Up @@ -127,6 +129,39 @@ public class LootLockerRedeemGooglePlayStorePurchaseForClassRequest : LootLocker
public int class_id { get; set; }
}

public class LootLockerRedeemEpicStorePurchaseForPlayerRequest
{
/// <summary>
/// The epic account id of the account that this purchase was made for
/// </summary>
public string account_id;
/// <summary>
/// This is the token from epic used to allow the LootLocker backend to verify ownership of the specified entitlements. This is sometimes referred to as the Server Auth Ticket or Auth Token depending on your Epic integration.
/// </summary>
public string bearer_token;
/// <summary>
/// The ids of the purchased entitlements that you wish to redeem
/// </summary>
public List<string> entitlement_ids;
/// <summary>
/// The Sandbox Id configured for the game making the purchase (this is the sandbox id from your epic online service configuration)
/// </summary>
public string sandbox_id;
}

public class LootLockerRedeemEpicStorePurchaseForClassRequest : LootLockerRedeemEpicStorePurchaseForPlayerRequest
{
/// <summary>
/// The ulid of the character to redeem this purchase for
/// </summary>
#if LOOTLOCKER_USE_NEWTONSOFTJSON
[JsonProperty("character_id")]
#else
[Json(Name = "character_id")]
#endif
public int class_id;
}

/// <summary>
///
/// </summary>
Expand Down
Loading