<iframe style="height:600px; width:100%"
src="https://adstringer.com/offer/[SITE_KEY]/[USER_ID]"></iframe>
You need to replace [SITE_KEY] with the public key of your adstringer site and the [USER_ID] with the unique id of user in your system.
Whenever a user completes an offer, we'll make a call to the postback url that you added while adding your site attaching all the required parameters that you will need to reward your users.
Our server will make an HTTP GET request to your server including all the following parameters:
| Params | Description |
|---|---|
| subId | The unique identifier for the user who completed the offer. |
| transId | Unique identification code of the transaction made by your user on Adstringer. |
| reward | The amount of the reward that the user earned for completing the offer. |
| payout | The offer payour in $ |
| signature | MD5 hash that can be used to verify that the call has been made from our servers |
| status | Determines whether to add or subtract the amount of the reward. "1" is when the virtual currency should be added to the user and "2" when it should be subtracted. This may be because the advertiser has canceled the user's transaction, either because he/she committed fraud or because it has been a mistake entering the data needed to complete the campaign |
| userIp | The user's IP Address who completed the action. |
| offer_name | Name of the offer to be completed. "offer" will send if name not exists |
| country | Country (ISO2 Form) from the lead comes |
"Rewards" and "Payout" parameters are always absolute values, you will need to check the "Status" parameter to see if you need to add or subtract that amount from your users
You should verify the signature received in the postback to ensure that the call comes from our servers. The signature parameter should match the MD5 of
subid, transactionid, reward secret
You can find your secret in your app dashboard.The formula to be checked is as follows:
<?php
$secret = ""; //
$subId = isset($_GET['subId']) ? $_GET['subId'] : null;
$transId = isset($_GET['transId']) ? $_GET['transId'] : null;
$reward = isset($_GET['reward']) ? $_GET['reward'] : null;
$signature = isset($_GET['signature']) ? $_GET['signature'] : null;
// validate signature
if(md5($subId.$transId.$reward.$secret) != $signature)
{
echo "ERROR: Signature doesn't match";
return;
}
? >
Our server will expect the following answers:
Our servers wait for a response for a maximum of 60 seconds before the 'timeout'. Please check if the transaction ID sent to you was already entered in your database. This will prevent giving twice the same amount of virtual currency to the user because of the timeout.
<?php
$secret = ""; //
$userId = isset($_GET['subId']) ? $_GET['subId'] : null;
$transactionId = isset($_GET['transId']) ? $_GET['transId'] : null;
$points = isset($_GET['reward']) ? $_GET['reward'] : null;
$signature = isset($_GET['signature']) ? $_GET['signature'] : null;
$action = isset($_GET['status']) ? $_GET['status'] : null;
$ipuser = isset($_GET['userIp']) ? $_GET['userIp'] : "127.0.0.0";
// validate signature
if(md5($userId.$transactionId.$points.$secret) != $signature)
{
echo "ERROR: Signature doesn't match";
return;
}
if($action == 2) // action = 1 CREDITED // action = 2 REVERSAL
{
$points = -abs($points);
}
if(isNewTransaction($transactionId)) // Check if the transaction is new
{
rewardUser($userId, $points, $transactionId);
echo "OK";
}
else
{
// If the transaction already exist please echo DUP.
echo "DUP";
}
?>