Skip to content

Make Purchases Through PlayStation

This how-to implements the in-game purchase flow for PlayStation Store, from initiating a purchase to validating it and granting rewards to the player.

Prerequisites

Initiate Purchase In-Game

Trigger the PlayStation Store purchase flow from your game using the PlayStation commerce APIs.

Validate Purchase with LootLocker

Send the PlayStation entitlement information to LootLocker for validation. LootLocker verifies the purchase with PlayStation Store before granting any rewards.

LootLockerSDKManager.RedeemPlaystationStorePurchaseForPlayer(
transaction_id: transactionIdFromPlayStation,
auth_code: authCodeFromPlayStation,
entitlement_label: "entitlement_label_configured_in_np_service",
onComplete: (response) =>
{
if (response.success)
{
Debug.Log("Purchase validated and rewards granted!");
// Refresh player data to see the granted rewards
LootLockerSDKManager.GetPlayerData((playerResponse) =>
{
if (playerResponse.success)
{
Debug.Log("Player data updated with new rewards");
}
});
}
else
{
Debug.LogError("Failed to validate purchase: " + response.errorData.message);
}
}
);

Grant Rewards to a Player

After successful validation, LootLocker grants the configured rewards (Assets, Currency, and Progressions) to the player. Your game should then retrieve the updated player data to reflect the granted rewards.

Grant Rewards to a Character Class

If your game uses Character Classes, you can grant rewards directly to a Character Class instead of the player. This is useful for character-specific purchases or unlocks.

LootLockerSDKManager.RedeemPlaystationStorePurchaseForClass(
transaction_id: transactionIdFromPlayStation,
auth_code: authCodeFromPlayStation,
entitlement_label: "entitlement_label_configured_in_np_service",
classId: playerClassId,
onComplete: (response) =>
{
if (response.success)
{
Debug.Log("Purchase validated and rewards granted to class!");
}
else
{
Debug.LogError("Failed to validate purchase: " + response.errorData.message);
}
}
);

Handle Edge Cases

Make sure your implementation accounts for:

  • Failed or cancelled purchases
  • Pending or incomplete purchase flows
  • Duplicate entitlement redemption
  • Refund handling for consumed purchases
  • Restoring or checking ownership for durable entitlements

LootLocker handles purchase validation and reward granting, but your game is responsible for the player experience and refreshing player state after rewards are granted.

Conclusion

You've implemented the full PlayStation Store purchase flow: initiating a purchase using the PlayStation commerce APIs, validating the entitlement through LootLocker, and granting rewards to the player. Review LootLocker's full feature set to decide which other features to implement.