# Setup S2S Postback

## Setting Up Postback URL

We fire an HTTP GET request to the provided postback URL. The following query parameters will be consider.

```url
//Example URL

https://www.example.com/postbacks/postback_file_name.php
```

<table><thead><tr><th width="206">Query Params	</th><th>Description</th></tr></thead><tbody><tr><td><code>user_id</code></td><td>Unique identifier of the user from your app.</td></tr><tr><td><code>offer_id</code></td><td>The identifier of the offer for which the user receives a postback.</td></tr><tr><td><code>offer_name</code></td><td>The name of the offer for which the user receives a postback.</td></tr><tr><td><code>payout</code></td><td>The amount earned per completed milestone by publisher.</td></tr><tr><td><code>amount</code></td><td>The value of the reward earned by the end user.</td></tr><tr><td><code>signature</code></td><td>Hash of the above values to verify the request</td></tr><tr><td><code>task_name</code></td><td>The name of task for which user receives reward (for level or playtime offers)</td></tr><tr><td><code>task_id</code></td><td>The id of task for which user receives reward (for level or playtime offers)</td></tr><tr><td><code>currency_name</code></td><td>The currency name you have set will be sent to you in this variable in the postback.</td></tr></tbody></table>

**Example**

user\_id = `123`

offer\_id = `123`&#x20;

offer\_name = `Test_game`&#x20;

payout = `500`

amount= `250`

signature = `45786sdg458-sdg465-659s465sdg-465ery98bm`

task\_name = `Complete_level_X`

task\_id = `162657`&#x20;

currency\_name = `Coin`

PostbackURL ->  `https://www.example.com/postbacks/postback_file_name.php?user_id=123&offer_id=123&offer_name=Test_game&payout=500&amount=250&signature=45786sdg458-sdg465-659s465sdg-465ery98bm&task_name=Complete_level_X&task_id=162657&currency_name=Coin`&#x20;

### Sample code to validate request

{% 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'];
 $task_id = $_REQUEST['task_id'];
 $task_name = $_REQUEST['task_name'];
 $currency_name = $_REQUEST['currency_name '];

 $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>.$<a data-footnote-ref href="#user-content-fn-3">coin_amount</a>."<a data-footnote-ref href="#user-content-fn-4">YOUR_APPLICATION_KEY</a>"."<a data-footnote-ref href="#user-content-fn-5">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/earaKcSwTsiKVBUUbBVU" 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.

<figure><img src="/files/1kA2fWN8bM5ytB6S8Wyo" alt=""><figcaption></figcaption></figure>

#### How It Works:

1. Enter the **User ID** (this must match the User ID used in your SDK initialization).
2. Click **Send** **Test Postback**.

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

#### **Points to keep in mind while setting up postback URL**

* All parameters are append from our side publisher has to give only path to their postback file.
* Value of amount passed in postback is converted in your given app currency at your given currency rate in exchange of 1$.

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

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

[^3]: The value of the reward earned by the end user.

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

[^5]: 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/sdk-integration/setup-s2s-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.
