Start a new basket session (InGameCart)
This assumes you are not using the built-in StoreBrowser, which automatically manages the cart for you if enabled.
using Tebex.TebexUnity;
using Tebex.Headless;
using UnityEngine;
public class StoreController : MonoBehaviour
{
[SerializeField] InGameCart cart;
// Call this once when the player opens the store.
// Pass the in-game username; alternatively use NewBasketWithEmail().
public void StartSession(string playerUsername)
{
cart.NewBasketWithUsername(playerUsername);
}
// Call this when the player clicks "Add to Cart" on a product.
public void OnAddToCart(Package package)
{
cart.AddPackage(package);
cart.Open(); // Slide the cart into view
}
}Last updated
Was this helpful?

