Avixolabs Documentation

Complete integration guide for offerwall implementation.

Account required before integration. Register first to get API keys.

Integration Methods

JavaScript Integration
// Method 1: Open in new window
window.open("https://avixolabs.com/offerwall/API_KEY/USER_ID", "_blank");

// Method 2: Open in popup window
function openOfferwallPopup() {
    const width = 800;
    const height = 600;
    const left = (window.screen.width - width) / 2;
    const top = (window.screen.height - height) / 2;
    
    window.open(
        "https://avixolabs.com/offerwall/API_KEY/USER_ID",
        "offerwall",
        `width=${width},height=${height},left=${left},top=${top}`
    );
}

// Method 3: Open on button click
document.getElementById('offerwall-btn').addEventListener('click', function() {
    openOfferwallPopup();
});
iFrame Integration
<!-- Direct iframe integration -->
<iframe 
  src="https://avixolabs.com/offerwall/API_KEY/USER_ID"
  width="100%" 
  height="600"
  frameborder="0"
  scrolling="yes"
  style="border-radius: 8px;"
>
</iframe>

<!-- With responsive container -->
<div style="width: 100%; height: 600px; border-radius: 8px; overflow: hidden;">
  <iframe 
    src="https://avixolabs.com/offerwall/API_KEY/USER_ID"
    style="width: 100%; height: 100%; border: none;"
  ></iframe>
</div>
Android Integration (Java)
// Method 1: Open in WebView
WebView webView = findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://avixolabs.com/offerwall/API_KEY/USER_ID");

// Method 2: Open in Chrome Custom Tabs
String url = "https://avixolabs.com/offerwall/API_KEY/USER_ID";
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(context, Uri.parse(url));

// Method 3: Open in Browser
Intent browserIntent = new Intent(Intent.ACTION_VIEW, 
    Uri.parse("https://avixolabs.com/offerwall/API_KEY/USER_ID"));
startActivity(browserIntent);
Android Integration (Kotlin)
// Method 1: WebView in Kotlin
val webView: WebView = findViewById(R.id.webView)
webView.settings.javaScriptEnabled = true
webView.webViewClient = WebViewClient()
webView.loadUrl("https://avixolabs.com/offerwall/API_KEY/USER_ID")

// Method 2: Chrome Custom Tabs
val url = "https://avixolabs.com/offerwall/API_KEY/USER_ID"
val builder = CustomTabsIntent.Builder()
val customTabsIntent = builder.build()
customTabsIntent.launchUrl(this, Uri.parse(url))
iOS Integration (Swift)
// Method 1: WKWebView
import WebKit

class ViewController: UIViewController, WKUIDelegate {
    var webView: WKWebView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let webConfiguration = WKWebViewConfiguration()
        webView = WKWebView(frame: .zero, configuration: webConfiguration)
        webView.uiDelegate = self
        
        view = webView
        
        let urlString = "https://avixolabs.com/offerwall/API_KEY/USER_ID"
        if let url = URL(string: urlString) {
            let request = URLRequest(url: url)
            webView.load(request)
        }
    }
}

// Method 2: SFSafariViewController
import SafariServices

func openOfferwall() {
    let urlString = "https://avixolabs.com/offerwall/API_KEY/USER_ID"
    if let url = URL(string: urlString) {
        let safariVC = SFSafariViewController(url: url)
        present(safariVC, animated: true)
    }
}

// Method 3: Open in Safari
func openInSafari() {
    let urlString = "https://avixolabs.com/offerwall/API_KEY/USER_ID"
    if let url = URL(string: urlString) {
        UIApplication.shared.open(url)
    }
}
React Native Integration
// Method 1: Using React Native WebView
import React from 'react';
import { WebView } from 'react-native-webview';

const OfferwallScreen = () => {
  const url = "https://avixolabs.com/offerwall/API_KEY/USER_ID";
  
  return (
    <WebView
      source={{ uri: url }}
      style={{ flex: 1 }}
      javaScriptEnabled={true}
      domStorageEnabled={true}
    />
  );
};

// Method 2: Using Linking to open in browser
import { Linking } from 'react-native';

const openOfferwall = async () => {
  const url = "https://avixolabs.com/offerwall/API_KEY/USER_ID";
  const supported = await Linking.canOpenURL(url);
  
  if (supported) {
    await Linking.openURL(url);
  } else {
    console.log("Cannot open URL");
  }
};

// Method 3: Using React Navigation WebView
import * as React from 'react';
import { WebView } from 'react-native-webview';

function OfferwallWebView() {
  return (
    <WebView
      source={{
        uri: "https://avixolabs.com/offerwall/API_KEY/USER_ID",
      }}
      style={{ marginTop: 20 }}
    />
  );
}
Note for React Native: You need to install react-native-webview package: npm install react-native-webview

S2S Postback

Parameter Description Example
subId This is the unique identifier code of the user who completed action on your platform. user123
transId Unique identification code of the transaction made by your user. XX-12345678
offer_name Name of the completed offer. Avixolabs - Register and Earn
offer_type Type of the offer completed by user (ptc, offer, task, shortlink). ptc
reward Amount of your virtual currency to be credited to your user. 1.25
reward_name The name of your currency set when you registered your website. Points
reward_value Amount of your virtual currency credited for $1 worth of payout (Exchange Rate). 1000.00
payout The offer payout in USD 0.100000
userIp The user's IP address who completed the action. 192.168.1.0
country Country (ISO2 form) from the lead comes. 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. 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. 1 (valid) / 2 (chargeback)
signature MD5 hash that can be used to verify that the call has been made from our servers. 17b4e2a70d6efe9796dd4c5507a9f9ab

Postback Example

Complete PHP Postback Handler
<?php
// Postback URL handler for Avixolabs
// 1. Configuration
$secretKey = "YOUR_SECRET_KEY_HERE"; // Get from dashboard
$allowedIPs = ['192.168.1.1', '10.0.0.1']; // Add allowed IPs here

// 2. Security check - IP validation (optional but recommended)
$clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'];
if (!in_array($clientIP, $allowedIPs)) {
    http_response_code(403);
    die("Access denied: Invalid IP");
}

// 3. Get POST parameters
$subId = $_POST['subId'] ?? '';
$transId = $_POST['transId'] ?? '';
$reward = $_POST['reward'] ?? 0;
$status = $_POST['status'] ?? 1;
$signature = $_POST['signature'] ?? '';

// 4. Validate required parameters
if (empty($subId) || empty($transId) || empty($signature)) {
    http_response_code(400);
    die("Missing required parameters");
}

// 5. Validate signature
$expectedSignature = md5($subId . $transId . $reward . $secretKey);
if (!hash_equals($expectedSignature, $signature)) {
    http_response_code(401);
    die("Invalid signature");
}

// 6. Check for duplicate transaction (prevent double processing)
function isDuplicateTransaction($transactionId) {
    // Implement your duplicate check logic here
    // Example: Check database for existing transaction
    // return checkIfTransactionExists($transactionId);
    return false;
}

if (isDuplicateTransaction($transId)) {
    echo "ok"; // Already processed, respond ok
    exit;
}

// 7. Handle status (1 = credit, 2 = chargeback)
if ($status == 2) {
    // Chargeback - subtract reward from user
    $reward = -abs($reward);
} else {
    // Normal credit - ensure positive value
    $reward = abs($reward);
}

// 8. Process the transaction
try {
    // Add your transaction processing logic here
    // Example: creditUser($subId, $reward, $transId);
    
    // Log the transaction
    // logTransaction($transId, $subId, $reward, $status);
    
    // 9. Store transaction to prevent duplicates
    // storeTransaction($transId);
    
    // 10. Success response
    header('Content-Type: text/plain');
    echo "ok";
    
} catch (Exception $e) {
    // Log error
    error_log("Postback error: " . $e->getMessage());
    
    // Return error (our system will retry)
    http_response_code(500);
    die("Error processing transaction");
}

/**
 * Helper function examples
 */

function creditUser($userId, $amount, $transactionId) {
    // Implement your user credit logic
    // Update user balance in your database
}

function logTransaction($transactionId, $userId, $amount, $status) {
    // Implement your logging logic
    // Save to database or log file
}

function storeTransaction($transactionId) {
    // Store transaction ID to prevent duplicates
    // Save to database or cache
}

function checkIfTransactionExists($transactionId) {
    // Check if transaction already processed
    // Query database or cache
    return false;
}
?>
Important: Always respond with "ok" (lowercase) for successful postbacks. Our system will retry failed postbacks.

IPs to Whitelist

To ensure security, whitelist the following IP addresses in your server/firewall configuration:

198.54.114.63
IP Validation Example
<?php
// List of allowed IPs from Avixolabs

$allowed_ips = [
    '198.54.114.63',
];

if (!in_array(VisitorIP(), $allowed_ips)) {
	echo "ERROR: Invalid source";
	return;
}


?>