📝Postback

Embark on a seamless journey as we walk you through the process of setting up your very own Postback. Each step is clearly explained, providing you with detailed guidance to ensure a smooth, success.

Postback Parameters

PARAMETER
DESCRIPTION
EXAMPLE

{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.

Pitchium - 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://offerwall.pitchium.com?user_id={user_id}&payout{payout}&user_ip={user_ip}&offerName={offerName}&reward={reward}&country={country}&status={status}&debug={debug}

Important Reminder:

For a successful interaction, our servers anticipate an HTTP Status Code 200 from your Postback URL. If this response is not received, we'll make up to five additional attempts, with a one-hour interval between each. After the fifth attempt, an email indicating Postback failure will be sent.

Please note that the response message from your postback endpoint should not contain error-related terms like "fail" or "error." Any inclusion of such messages will be regarded as a postback failure.

<?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
}