Porix Docs
  • ๐Ÿš€ Quick Start
  • ๐ŸšฉMonetization
    • ๐ŸŽฏAccount Setup
    • โš™๏ธPostback
      • ๐Ÿš€Script Pocket
    • ๐Ÿ“ดWeb Offerwall
Powered by GitBook
On this page
  • Postback Parameters
  • Examples
  1. Monetization

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.

Key Insight: After a user successfully completes an offer, our system promptly triggers a call to the Postback URL you've designated within your placement. This call includes all pertinent details needed to reward your users, acting as a real-time notification to your server.

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.

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
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=2

Important Reminder:

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

Please take note that the response message from your postback endpoint should refrain from containing 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
}
const http = require('http');
const url = require('url');

const server = http.createServer((req, res) => {
    const parsedUrl = url.parse(req.url, true);
    const query = parsedUrl.query;

    const { user_id, payout, user_ip, offerName, reward, country, status } = query;

    // Check if it's a chargeback
    const isChargeback = (status === '2');

    // Apply chargeback adjustments
    let adjustedReward = parseFloat(reward);
    if (isChargeback) {
        adjustedReward *= -1;
    }

    // Apply user points logic
    // In this example, you could update user points in your database
    // Replace this with your actual logic

    // Send a response to acknowledge receipt
    res.statusCode = 200;
    res.end('Postback successfully received.\n');
});

const port = 3000;
server.listen(port, () => {
    console.log(`Server is running on port ${port}`);
});
using System;
using System.Web.Mvc;

namespace PostbackExample.Controllers
{
    public class PostbackController : Controller
    {
        [HttpPost]
        public ActionResult Index(FormCollection form)
        {
            string user_id = form["user_id"];
            string payout = form["payout"];
            string user_ip = form["user_ip"];
            string offerName = form["offerName"];
            string reward = form["reward"];
            string country = form["country"];
            string status = form["status"];

            // Check if it's a chargeback
            bool isChargeback = (status == "2");

            // Apply chargeback adjustments
            int updatedReward = Convert.ToInt32(reward);
            if (isChargeback)
            {
                updatedReward = -updatedReward;
            }

            // Apply user points logic
            // In this example, you could update user points in your database
            // Replace this with your actual logic

            // Send a response to acknowledge receipt
            return new HttpStatusCodeResult(200);
        }
    }
}
PreviousAccount SetupNextScript Pocket

Last updated 1 year ago

๐Ÿšฉ
โš™๏ธ