Skip to content

Make Purchases Through Stripe

This how-to implements the purchase flow for Stripe, where players complete payment in their browser and LootLocker grants rewards once the purchase is confirmed.

Prerequisites

Create a Stripe Checkout Session

Unlike traditional platform IAP systems, Stripe purchases are handled by generating a secure checkout link that opens in the player's browser. This keeps sensitive payment information outside of your game while giving the player a trusted Stripe checkout experience.

To start the purchase, create a Stripe Checkout Session using the Catalog Listing ID for the item the player wants to buy. LootLocker returns a unique checkout URL and an entitlement ID for the pending purchase.

LootLockerSDKManager.CreateStripeCheckoutSession(catalogItemId, (response) =>
{
if (response.success)
{
Debug.Log("Stripe session created. Link: " + response.checkout_link);
// Open the Stripe checkout page in the user's browser
Application.OpenURL(response.checkout_link);
// Show a "Purchase in Progress" UI overlay in your game
purchaseInProgressScreen.SetActive(true);
// Start polling for the status of this specific entitlement
StartCoroutine(CheckPurchaseStatusRoutine(response.entitlement_id));
}
else
{
Debug.LogError("Failed to create session: " + response.errorData.message);
}
});

Open the returned Stripe checkout URL in the player's browser. Since payment happens outside the game, show an in-game purchase-in-progress screen while you wait for the transaction to complete.

Application.OpenURL(checkoutLink);

Check the Purchase Status

After opening the Stripe checkout link, use the entitlement ID returned by LootLocker to check the status of the purchase. Because the player completes payment externally, your game should poll LootLocker until the entitlement is either completed or no longer valid. We recommend checking the entitlement status every 5 seconds while the purchase is in progress.

IEnumerator CheckPurchaseStatusRoutine(string entitlementId)
{
while (!purchaseCompleted)
{
CheckPurchaseStatus(entitlementId);
yield return new WaitForSeconds(5f);
}
}
void CheckPurchaseStatus(string entitlementId)
{
LootLockerSDKManager.GetEntitlement(entitlementId, (response) =>
{
if (response.success)
{
if (response.Status == LootLocker.LootLockerEnums.LootLockerEntitlementHistoryListingStatus.Active)
{
// Success: The purchase is complete and rewards have been granted
purchaseInProgressScreen.SetActive(false);
purchaseCompleted = true;
}
else if (IsFailureStatus(response.Status))
{
// Player canceled or payment expired
purchaseInProgressScreen.SetActive(false);
purchaseCompleted = true;
}
}
});
}

Handle the Purchase Result

Once the entitlement status becomes active, the purchase is complete and the configured Catalog Listing rewards have been granted to the player. Update your in-game UI and unlock or display the purchased content.

If the purchase is cancelled, expires, or fails, inform the player, close the purchase-in-progress screen, and let the player try again.

Handle Edge Cases

Because Stripe purchases complete outside of the game, your game should handle several scenarios:

  • User closes the browser: the purchase may still complete — continue polling the entitlement status until it resolves.
  • Payment fails or is cancelled: the entitlement won't become active — stop polling and let the player retry.
  • Session expires: the checkout session may expire if it's not completed in time — create a new checkout session if needed.
  • Game isn't in focus: the player may return after completing the purchase — make sure your game resumes polling or refreshes entitlement state.
  • Network interruptions: retry entitlement checks to avoid false negatives.

Regardless of what state your game is in, the purchase completes if the player finishes it in their browser.

Conclusion

You've implemented the purchase flow for Stripe: players can start a Stripe checkout session, complete payment in their browser, and receive the configured rewards once LootLocker confirms the purchase. Review LootLocker's full feature set to decide which other features to implement.