# Rewarded Video Callbacks

## Adding your Callback URL

To handle video conversions with S2S Callbacks, first make sure your callback URL is setup correctly in your publisher placement.\
To do so, navigate to **Placements / Apps**, edit your placement and set the **Callback Url** to your server's postback url:

<figure><img src="/files/NFeI4c3Xbr9isNxbWenk" alt=""><figcaption></figcaption></figure>

Also make sure that **"Send S2S Callbacks"** for video views is enabled for your Rewarded Video AdSlot in "AdSlot Details" > "Overview".

<figure><img src="/files/atgnf7bSUatx2bYXhjPc" alt=""><figcaption></figcaption></figure>

If this is the callback url you set for your placement:

```
https://your-server.com/callback?network=ayetstudios&amount={currency_amount}&external_identifier={external_identifier}&payout_usd={payout_usd}&adslot_id={adslot_id}
```

A typical conversion callback sent by our server will look like this:

```
https://your-server.com/callback?network=ayetstudios&amount=10&external_identifier=username&payout_usd=0.007&adslot_id=16
```

{% hint style="success" %}
This assumes you set externalIdentifier to **username** when calling `AyetVideoSdk.init(...)`, the currency amount per view was set to **10** in your rewarded video adslot #16 and the delivered video had an eCPM of **$7.00**.
{% endhint %}

{% hint style="info" %}
**Hint:** If you send callbacks from multiple different adslots (e.g. rewarded\_video and offerwall) make sure to pass and validate `{adslot_id}` in your callback URL to determine if the conversion was a normal offer or a rewarded video.
{% endhint %}

{% hint style="danger" %}
**Important:** Your server must always reply with an HTTP 200 status code to our postbacks. Otherwise we will resend the postback 12 times over a span of one hour before giving up.
{% endhint %}

## **Available Macros for Callback URLs:**

{% hint style="info" %}
**Note:** If the parsing capabilities of your callback endpoint are limited, each of the parameters below is also available in a sanitized version. By suffixing any of the parameters below with `_sanitized` (for example `{external_identifier_sanitized}`), any character that is not in `0-9 a-z A-Z - _` will be removed. Whitespaces will be replaced by underscores.
{% endhint %}

{% hint style="danger" %}
**Important:**\
To ensure each conversion is granted only once to your users, always use {transaction\_id}.\
\
Occasional callback resends may occur for various reasons. Utilizing {transaction\_id} prevents granting conversions more than once.
{% endhint %}

<table><thead><tr><th width="202.33333333333331">Variable</th><th width="150.36745987825125">Type</th><th>Description</th></tr></thead><tbody><tr><td>{transaction_id}</td><td>string</td><td>Unique transaction id - use for duplicate checks.</td></tr><tr><td>{payout_usd}</td><td>float</td><td>The actual conversion payout in USD.</td></tr><tr><td>{currency_amount}</td><td>float</td><td>The amount of currency the user earned (taken from your offerwall currency configuration).</td></tr><tr><td>{external_identifier}</td><td>string</td><td>The user identifier (EXTERNAL IDENTIFIER) originally passed in the web offerwall link</td></tr><tr><td>{user_id}</td><td>integer</td><td>Our internal id for this offerwall user</td></tr><tr><td>{placement_identifier}</td><td>string</td><td>The placement_identifier for which the conversion occured</td></tr><tr><td>{adslot_id}</td><td>int</td><td>The ID of the adslot for which the conversion occured</td></tr><tr><td>{sub_id}</td><td>string</td><td>The ID of the Placement for which the conversion occured<br>[PL-1...n]</td></tr><tr><td>{ip}</td><td>string</td><td>Converting device's IP address if known, 0.0.0.0 otherwise</td></tr><tr><td>{offer_id}</td><td>int</td><td>Offer ID of the converting offer</td></tr><tr><td>{offer_name}</td><td>string</td><td>Name / title of the converting offer</td></tr><tr><td>{device_uuid}</td><td>string</td><td>ayeT-Studios internal device identificator</td></tr><tr><td>{device_make}</td><td>string</td><td>Device manufacturer</td></tr><tr><td>{device_model}</td><td>string</td><td>Device model</td></tr><tr><td>{advertising_id}</td><td>string</td><td>Device advertising id (GAID/IDFA) if known, otherwise empty</td></tr><tr><td>{sha1_android_id}</td><td>string</td><td>Device sha1 hashed android id if known, otherwise empty</td></tr><tr><td>{sha1_imei}</td><td>string</td><td>Device sha1 hashed imei if known, otherwise empty</td></tr><tr><td>{currency_identifier}</td><td>string</td><td>Shows virtual currency name as set in adslot.</td></tr><tr><td>{currency_conversion_rate}</td><td>decimal</td><td>Shows currency conversion rate used to calculate user currency for the given conversion.</td></tr><tr><td>{custom_1}</td><td>string</td><td>Custom parameter to pass variables to the conversion callbacks</td></tr><tr><td>{custom_2}</td><td>string</td><td>Custom parameter to pass variables to the conversion callbacks</td></tr><tr><td>{custom_3}</td><td>string</td><td>Custom parameter to pass variables to the conversion callbacks</td></tr><tr><td>{custom_4}</td><td>string</td><td>Custom parameter to pass variables to the conversion callbacks</td></tr><tr><td>{custom_5}</td><td>string</td><td>Custom parameter to pass variables to the conversion callbacks</td></tr></tbody></table>


---

# 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.ayetstudios.com/v/product-docs/callbacks-and-testing/callbacks/rewarded-video-callbacks.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.
