# Basic reward delivery pattern

This is a basic rewards system that utilizes the **InGameCart** and **Deliverables** helpers included with our SDK.

{% hint style="info" %}
This is only an example and not a requirement for using the SDK. You can implement your own reward delivery per your requirements.\
\
Tebex also supports delivery with game server commands via the **Plugin API** and **Webhooks** sent to a backend you control.
{% endhint %}

```csharp
using Tebex.TebexUnity;
using Tebex.Headless;
using UnityEngine;

public class RewardManager : MonoBehaviour
{
    [SerializeField] Deliverables deliverables;
    [SerializeField] InGameCart cart;

    // Assume you have these packages (fetched from Tebex.Packages or Tebex.PackageLookup)
    [SerializeField] int goldPackageId = 1001;
    [SerializeField] int mountPackageId = 1002;

    void Start()
    {
        // Register what to do when each package is purchased.
        deliverables.RegisterDeliverableAction(goldPackageId, OnGoldPurchased);
        deliverables.RegisterDeliverableAction(mountPackageId, OnMountPurchased);
    }

    // After the player creates a basket and proceeds to checkout,
    // hand the basket to Deliverables so it starts polling.
    public void BeginWaitingForPayment()
    {
        Basket basket = cart.ActiveBasket;
        if (basket != null)
        {
            deliverables.SetActiveBasket(basket);
        }
    }

    void OnGoldPurchased(BasketPackage package)
    {
        int qty = package.in_basket.quantity;
        Debug.Log($"Player bought {qty}x {package.name}. Awarding gold...");
        // PlayerInventory.AddGold(qty * 1000);
    }

    void OnMountPurchased(BasketPackage package)
    {
        Debug.Log($"Player purchased: {package.name}. Unlocking mount...");
        // PlayerMounts.Unlock("DragonMount");
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tebex.io/developers/unity-engine/examples/basic-reward-delivery-pattern.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
