# 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="https://3792453041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAvJwGUkFBKS31rzOrgN%2Fuploads%2FPXLVOjsO4VKHxDdsKP6k%2Fimage.png?alt=media&#x26;token=ebeb8866-ed4f-4353-b632-1c264742e6b0" 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="https://3792453041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAvJwGUkFBKS31rzOrgN%2Fuploads%2FOVAeJlWUD0iG3rkLgf6l%2Fimage.png?alt=media&#x26;token=10a59173-8c94-4f2c-8cb4-b303acd26745" 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.**
