⚙️Postback
Embark on a smooth journey as we guide you through the process of setting up your very own Postback. Each step is carefully explained, ensuring you have comprehensive guidance throughout the process.
Postback Parameters
{user_id}
The id of your user, the one you have placed in the iframe integration. This id should not be empty or 0.
user1
{payout}
Complete payment in USD, paid to the publisher.
0.01
{user_ip}
IP Address of the user when the click happened.
192.168.1.1
{offerName}
Name of the completed offer.
Porix - Sign up and Earn
{reward}
User reward in app currency. You can configure it in the currency settings.
500
{country}
The country the user took the offer from as ISO2 Code.
US
{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.
1 (valid) / 2 (chargeback)
{debug}
Check if it’s a test or a live postback call.
1 (test) / 0 (live)
Examples
This is how we call your postback url
https://example.com/api/porix.php?user_id={user_id}&payout{payout}&user_ip={user_ip}&offerName={offerName}&reward={reward}&country={country}&status={status}&debug={debug}
https://example.com/api/porix.php?user_id=user1&payout=0.01&user_ip=192.168.1.1&offerName=Porix%20-%20Sign%20up%20and%20Earn&reward=500&country=US&status=1
<?php
// Retrieve the parameters from the request
$user_id = $_REQUEST['user_id'] ?? '';
$payout = $_REQUEST['payout'] ?? '';
$user_ip = $_REQUEST['user_ip'] ?? '';
$offerName = $_REQUEST['offerName'] ?? '';
$reward = $_REQUEST['reward'] ?? '';
$country = $_REQUEST['country'] ?? '';
$status = $_REQUEST['status'] ?? '';
// Check if it's a chargeback
$isChargeback = ($status === '2');
// Apply chargeback adjustments
if ($isChargeback) {
$reward = -$reward;
$payout = -$payout;
}
// Apply user points logic
// In this example, let's assume you have a user points system
$userPoints = getUserPoints($user_id); // Replace with your logic to fetch user points
if ($userPoints !== false) {
// Update user points based on reward
$userPoints += $reward;
// Update user points in the database or wherever it's stored
updateUserPoints($user_id, $userPoints); // Replace with your logic to update user points
}
// Send a response to acknowledge receipt
http_response_code(200);
echo 'Postback successfully received.';
// Function to simulate fetching user points (replace with actual logic)
function getUserPoints($userId) {
// Simulate fetching user points from a database
// Replace this with your actual logic to fetch user points
// Return user points or false if user not found
return 1000; // For example
}
// Function to simulate updating user points (replace with actual logic)
function updateUserPoints($userId, $newPoints) {
// Simulate updating user points in a database
// Replace this with your actual logic to update user points
// Return true if update successful, or false if not
return true; // For example
}
Last updated