# Add Promo Item

{% hint style="success" %}
#### Like what you're seeing?

Support us as a [GitHub Sponsor](../../../../where-to-buy/become-a-sponsor) and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude.\
\
These articles are made possible by our [GitHub Sponsors](../../../../where-to-buy/become-a-sponsor) ... become a sponsor today!
{% endhint %}

## Introduction

Grant a specific one-time promotional item to the current user.

This can be safely called from the client because the items it can grant can be locked down via policies in the itemdefs. One of the primary scenarios for this call is to grant an item to users who also own a specific other game. This can be useful if your game has a custom UI for showing a specific promo item to the user otherwise if you want to grant multiple promotional items then use [AddPromoItems](https://partner.steamgames.com/doc/api/ISteamInventory#AddPromoItems) or [GrantPromoItems](https://partner.steamgames.com/doc/api/ISteamInventory#GrantPromoItems).

Any items that can be granted MUST have a "promo" attribute in their itemdef. That promo item lists a set of APPIDs that the user must own to be granted this given item. This version will grant all items that have promo attributes specified for them in the configured item definitions. This allows adding additional promotional items without having to update the game client. For example, the following will allow the item to be granted if the user owns either TF2 or SpaceWar.

```json
promo: owns:440;owns:480
```

## Options

Heathen provides two sets of options when working with this endpoint. You can add a single promo item or multiple, and you can use the "Native" or "Simple" version. The Simple version uses a callback that will invoke when the result is ready as opposed to returning a handle that you would need to manage your self

<figure><img src="https://4053370152-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZWu8yFOWhCYCMkJFmR%2Fuploads%2FGauhuIipoWA4wDNTlmjN%2Fimage.png?alt=media&#x26;token=76b49fa4-4676-4a06-bfe6-a059f74882ef" alt=""><figcaption></figcaption></figure>

<details>

<summary>Simple</summary>

Our Simple variant will save you a lot of effort by handling the result-ready event for you, processing any requested properties and handing you a completed collection of item details when it's all done.

With the simple method, you should provide the item you wish to add as well as any properties you would like us to read from the resulting item. In most cases you won't need additional properties read however if your items have generators on them that create custom properties on creation then you may want to have us read those for you

#### Item Def (input)

The item to grant the player

#### Read Properties (input)

An array of strings being the keys for each property you would like us to read for you

#### Callback (input)

The callback is an event that will contain the [UEResult](../enumerators/ueresult) of the request and an array of [Item Detail With Properties](../types/item-detail-with-properties)

### Example

<img src="https://4053370152-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZWu8yFOWhCYCMkJFmR%2Fuploads%2FMhSek50r2HgNBEMLOVs2%2Fimage.png?alt=media&#x26;token=bbf2e8d5-e27a-4b30-b27a-02efb8d50961" alt="Simple Add Promo Item Example" data-size="original">

Note that we never return the result handle to you, we track this handle, process the items, read the requested properties and destroy the handle for you returning to you the resulting data in an array.

</details>

<details>

<summary>Native</summary>

The native Steam API works by issuing the request and returning an Item Request Handle when the request is filled Steam will execute the Result Ready callback. You must then read the details, properties and other aspects you desire from the result and then destroy the result handle.

#### Item Def (input)

The definition ID of the item to grant the player.

### Example

To get the handle you make your request, and check if the request was successful, if so store that request ... you'll need the handle from it later. This will prompt Steam to execute the Result Ready event when the results have been read.

<img src="https://4053370152-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZWu8yFOWhCYCMkJFmR%2Fuploads%2FexYzfKp5GzdKqVNpCkDq%2Fimage.png?alt=media&#x26;token=6a76a9a0-49f4-4a52-a066-e161dcf42f5f" alt="" data-size="original">

When the Result Ready is executed you will need to check if it matches your result handle, fetch the items contained in that result, and for each item fetch whatever additional properties you may need.



<img src="https://4053370152-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZWu8yFOWhCYCMkJFmR%2Fuploads%2FqVUdOKCIlEbRwMC7bhKI%2Fimage.png?alt=media&#x26;token=2fb48a69-e09a-440b-8e3e-372e3046f327" alt="" data-size="original">

Importantly when you are done reading the data returned by that result you need to destroy the handle.

<img src="https://4053370152-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZWu8yFOWhCYCMkJFmR%2Fuploads%2Fecpo9z5YpP42F1wNi7ik%2Fimage.png?alt=media&#x26;token=42fda534-10ab-48ad-84a3-f71fa55c5cb8" alt="" data-size="original">

</details>
