# Setup Postback

When a user successfully completes an offer, Playtime SDK will send a **postback** to your server with the reward details.\
This ensures that rewards are delivered securely and accurately.

{% code overflow="wrap" %}

```
// Example Postback 

https://www.example.com/postbacks/postback_file_name.php?user_id={user_id}&offer_id={offer_id}&offer_name={offer_name}&payout={payout}&signature={signature}&event={event}&sub1={sub1}&sub2={sub2}&sub3={sub3}&sub4={sub4}&sub5={sub5}&sub6={sub6}&sub7={sub7}&sub8={sub8}&sub9={sub9}&sub10={sub10}&gaid={users_advertising_id}&clickIp={clickIpaddress}&clickDatetime={clickDatetime}&conversionDatetime={conversionDatetime}&timeZone={timeZone}&callback_type={callback_type}&currency_name={currency_name}&appKey={appKey}&amount={amount}
```

{% endcode %}

## Postback Parameters

| Parameter            | Description                                                                                      |
| -------------------- | ------------------------------------------------------------------------------------------------ |
| `user_id`            | Unique identifier of the user from your app (mentioned in iFrame url).                           |
| `offer_id`           | Unique ID of the campaign/offer.                                                                 |
| `offer_name`         | Name of the campaign (URL encoded).                                                              |
| `payout`             | Publisher payout amount in USD.                                                                  |
| `signature`          | Security hash to validate authenticity.                                                          |
| `event`              | Event Name (e.g., `install`, `signup`, `complete_level_2`).                                      |
| `sub1` - `sub10`     | Custom tracking parameters (optional).                                                           |
| `gaid`               | Google Advertising ID of the user (if available).                                                |
| `clickIp`            | IP address of the user when clicking the offer.                                                  |
| `clickDatetime`      | Timestamp of the click (in `YYYY_MM_DD HH:MM:SS` format).                                        |
| `conversionDatetime` | Timestamp when conversion occurred.                                                              |
| `timeZone`           | Time zone of conversion (e.g., IST).                                                             |
| `callback_type`      | Type of callback (e.g., `1 = Api Callback`, `2 = Direct offer Callback`, `3 = iFrame Callback`). |
| `amount`             | Reward coins/points to be credited to the user in your app.                                      |
| `appKey`             | Unique App Key assigned to your app.                                                             |
| `currency_name`      | Name of your inapp currency which you have set.                                                  |

### Sample code to validate signature

{% tabs %}
{% tab title="PHP" %}

<pre class="language-php"><code class="lang-php"> // Signature Authentication
 
 $userId = $_REQUEST['user_id'];
 $offer_id = $_REQUEST['offer_id'];
 $coin_amount = (int)$_REQUEST['amount'];
 $signature = $_REQUEST['signature'];
 $event= $_REQUEST['event'];

 $calculated_signature = sha1($<a data-footnote-ref href="#user-content-fn-1">userId</a>.$<a data-footnote-ref href="#user-content-fn-2">offer_id</a>.$event."<a data-footnote-ref href="#user-content-fn-3">YOUR_APPLICATION_KEY</a>"."<a data-footnote-ref href="#user-content-fn-4">YOUR_APPLICATION_SECRET_KEY</a>");
 
 if($signature === $calculated_signature){
 // Request is valid
 }
</code></pre>

{% endtab %}
{% endtabs %}

## Test Callback Tool

We provide a dedicated **Test Callback Tool** so you can safely verify your callback configuration before going live.

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

**Key Features:**

* Safely test your callback URL without affecting live data.
* Instantly simulate user actions and reward payouts.
* Debug and validate parameters directly from the dashboard.

#### Input Fields:

* **User ID** → Simulates a user session.
* **Custom Parameters** → sub1=abc\&sub2=123\&sub5=xyz

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

#### How It Works:

1. Enter the **User ID** (this must match the User ID used in your SDK initialization).
2. Enter the **Custom Parameters** ( This is extra params which you can use to track conversions )&#x20;
3. Click **Send** **Test Postback**.

ℹ️ **Note**: Make sure the callback endpoint is correctly configured to receive and validate all required parameters.

[^1]: Your application `unique_id` set while initializing the SDK.

[^2]: The identifier of the offer for which the user receives a postback.

[^3]: Your Unique Application ID, which you get from manage App section in publisher panel.

[^4]: Your Application Secret Key, which you get from manage App section in your publisher panel. **This key is diffrent for all applications.**


---

# 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.playtimeads.com/iframe-integration/setup-postback.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.
