Documentation

Getting Started

Welcome to the Ewall documentation. Bellow you will find all required informations to integrate our offerwall into your website in just few minutes.

Before integrating our offerwall, make sure you're registered on our website, account is required to use any of our tools.


Add your Website

To be able to integrate our offerwall, first you have to add your website. Once you have added your website you will have an API KEY and a SECRET KEY, that you will need to integrate our offerwall.

To register your website into our service, please follow these steps:

  1. Login to your Ewall account.
  2. You should now see the Add Website button at sidebar. Click this button to add your first website.
  3. Set your Website Name, Domain Name and application type (platform) and proceed to next step.
  4. Set your Currency Name in plural form (e.g. Points, Tokens, Coins...), Currency Round (the number of decimals your currency can have, up to 2 decimals) and Exchange Rate (how many of your website currency units will a user earn for every 1 USD that we will pay you).
  5. Set your Postback URL. Whenever a user completes an offer, we will make a call to this URL by sending all the information needed to help you to credit the virtual currency to your users.
  6. Done! You have add your website, one of our team members will review it and once it is approved you will receive an email in the meantime you can continue with the integration process. You will find more informatons about postback integration in next chapters of this documentation.

API Integration

Our unified API system provides a single endpoint that handles all API interactions including Offers, Surveys, PTC, and Shortlinks. This documentation will help you integrate with our API services.

Authentication

All API requests require a valid Bearer token for authentication. You can generate this token in your website settings.

Every request must include an Authorization header with your Bearer token:

Authorization: Bearer [YOUR_BEARER_TOKEN]

Rate Limits

Please note: Our API has a rate limit of 1000 requests per 1 minute. Exceeding this limit may result in temporary access restrictions.

Offers API

To retrieve available offers for your users:

GET https://ewall.biz/api/offers?key=[API_KEY]&ip=[USER_IP]&sub_id=[USER_ID]&device=[DEVICE]&sort=[SORT]&limit=[LIMIT]
Parameters:
Parameter Required Description
key Yes Your API key from website settings
ip Yes IP address of the user
sub_id Yes Unique identifier of the user
device No Filter offers by device type (android, ios, desktop)
provider No Filter offers by provider
sort No Sort offers by reward (high, low)
limit No Limit number of offers returned
Example Response:

		{
		  "status": 200,
		  "message": "success",
		  "data": [
			{
			  "id": "offer123",
			  "title": "Complete Survey",
			  "description": "Answer questions about your shopping habits",
			  "reward": "5.00",
			  "raw_reward": 5,
			  "currency_name": "coins",
			  "url": "https://ewall.biz/...",
			  "image": "https://example.com/image.jpg",
			  "provider": "adscendmedia",
			  "devices": ["android", "ios", "desktop"]
			}
		  ]
		}
		  
PHP Integration Example:

		class OffersAPI {
		  private $baseUrl = 'https://ewall.biz/api/offers';
		  private $apiKey;
		  private $bearerToken;
		  
		  public function __construct($apiKey, $bearerToken) {
			$this->apiKey = $apiKey;
			$this->bearerToken = $bearerToken;
		  }
		  
		  public function getOffers($userId, $userIp, $device = '', $sort = 'high', $limit = 10) {
			$url = $this->baseUrl . '?key=' . $this->apiKey 
				 . '&ip=' . urlencode($userIp)
				 . '&sub_id=' . urlencode($userId);
			
			if(!empty($device)) $url .= '&device=' . urlencode($device);
			if(!empty($sort)) $url .= '&sort=' . urlencode($sort);
			if(!empty($limit)) $url .= '&limit=' . urlencode($limit);
			
			return $this->makeRequest($url);
		  }
		  
		  private function makeRequest($url) {
			$ch = curl_init();
			curl_setopt_array($ch, [
			  CURLOPT_URL => $url,
			  CURLOPT_RETURNTRANSFER => true,
			  CURLOPT_HTTPHEADER => [
				'Authorization: Bearer ' . $this->bearerToken,
				'Accept: application/json'
			  ],
			  CURLOPT_TIMEOUT => 30
			]);
			
			$response = curl_exec($ch);
			$error = curl_error($ch);
			curl_close($ch);
			
			if($error) {
			  return ['error' => $error];
			}
			
			return json_decode($response, true);
		  }
		}

		// Usage example
		$apiKey = 'your_api_key';
		$bearerToken = 'your_bearer_token';
		$api = new OffersAPI($apiKey, $bearerToken);

		$offers = $api->getOffers(
		  'user123',           // User ID
		  '123.45.67.89',      // User IP
		  'android',           // Device (optional)
		  'high',              // Sort (optional)
		  10                   // Limit (optional)
		);

		if(isset($offers['data'])) {
		  foreach($offers['data'] as $offer) {
			echo "Title: {$offer['title']}\n";
			echo "Reward: {$offer['reward']} {$offer['currency_name']}\n";
			echo "URL: {$offer['url']}\n\n";
		  }
		}
		  

Surveys API

To retrieve available surveys for your users:

GET https://ewall.biz/api/surveys?key=[API_KEY]&ip=[USER_IP]&sub_id=[USER_ID]&device=[DEVICE]&sort=[SORT]&limit=[LIMIT]

The parameters and response format are similar to the Offers API. The response will contain survey-specific data.

PTC (Paid to Click) API

To retrieve available PTC campaigns:

GET https://ewall.biz/api/[API_KEY]/[USER_ID]/[USER_IP]
Example Response:

		{
		  "status": 200,
		  "message": "success",
		  "data": [
			{
			  "id": "8098",
			  "image": "https://ewall.biz/files/ptc/image.jpg",
			  "title": "Visit Website",
			  "description": "Visit our sponsor's website",
			  "duration": "30",
			  "reward": "600.00",
			  "currency_name": "Cash",
			  "url": "https://ewall.biz/view/...",
			  "boosted_campaign": false,
			  "allowed_countries": "*",
			  "ad_type": "Iframe"
			}
		  ]
		}
		  
PTC API PHP Integration Example:

		class PtcAPI {
		  private $url;
		  private $token;

		  public function __construct($apiKey, $userId, $userIp, $token) {
			$this->url = 'https://ewall.biz/api/'.$apiKey.'/'.$userId.'/'.$userIp;
			$this->token = $token;
		  }

		  private function getWithFileContents() {
			$options = [
			  'http' => [
				'header' => "Authorization: Bearer {$this->token}\r\n",
				'timeout' => 10
			  ]
			];
			return @file_get_contents($this->url, false, stream_context_create($options));
		  }

		  private function getWithCurl() {
			$ch = curl_init();
			curl_setopt_array($ch, [
			  CURLOPT_URL => $this->url,
			  CURLOPT_RETURNTRANSFER => true,
			  CURLOPT_HTTPHEADER => ["Authorization: Bearer {$this->token}"],
			  CURLOPT_TIMEOUT => 10
			]);
			$response = curl_exec($ch);
			curl_close($ch);
			return $response;
		  }

		  public function getData() {
			$response = $this->getWithFileContents() ?: $this->getWithCurl();
			if(!$response) return false;

			$data = json_decode($response, true);
			return $data ?: false;
		  }
		}

		// Example usage:
		$api_key = 'your_api_key_here'; // From your offerwall settings
		$bearer_token = 'your_access_token_here'; // From your offerwall settings 
		$user_ip = $_SERVER['REMOTE_ADDR']; // User IP
		$user_id = 'user123'; // User ID

		$api = new PtcAPI($api_key, $user_id, $user_ip, $bearer_token);
		$result = $api->getData();

		if($result && $result['status'] == 200) {
		  foreach($result['data'] as $ptc) {
			echo $ptc['title'] . "\n";
			echo $ptc['description'] . "\n";
			echo $ptc['duration'] . "\n";
			echo $ptc['url'] . "\n";
			echo "---------------\n";
		  }
		} else {
		  echo "Request failed";
		}
		  

Shortlink API

To retrieve available shortlinks:

GET https://ewall.biz/sl-api/[API_KEY]/[USER_ID]/[USER_IP]
Example Response:

		{
		  "status": 200,
		  "message": "success",
		  "data": [
			{
			  "id": "1",
			  "title": "shortlink1",
			  "reward": "600.00",
			  "currency_name": "Cash",
			  "completion_rate": "100.00",
			  "available": "2",
			  "limit": "2",
			  "url": "https://ewall.biz/start/...",
			  "boosted_campaign": false
			}
		  ]
		}
		  
Shortlink API PHP Integration Example:

		class ShortlinkAPI {
		  private $url;
		  private $token;

		  public function __construct($apiKey, $userId, $userIp, $token) {
			$this->url = 'https://ewall.biz/sl-api/'.$apiKey.'/'.$userId.'/'.$userIp;
			$this->token = $token;
		  }

		  private function getWithFileContents() {
			$options = [
			  'http' => [
				'header' => "Authorization: Bearer {$this->token}\r\n",
				'timeout' => 10
			  ]
			];
			return @file_get_contents($this->url, false, stream_context_create($options));
		  }

		  private function getWithCurl() {
			$ch = curl_init();
			curl_setopt_array($ch, [
			  CURLOPT_URL => $this->url,
			  CURLOPT_RETURNTRANSFER => true,
			  CURLOPT_HTTPHEADER => ["Authorization: Bearer {$this->token}"],
			  CURLOPT_TIMEOUT => 10
			]);
			$response = curl_exec($ch);
			curl_close($ch);
			return $response;
		  }

		  public function getData() {
			$response = $this->getWithFileContents() ?: $this->getWithCurl();
			if(!$response) return false;

			$data = json_decode($response, true);
			return $data ?: false;
		  }
		}

		// Example usage with real values:
		$api_key = 'your_api_key_here'; // From your offerwall settings
		$bearer_token = 'your_access_token_here'; // From your offerwall settings  
		$user_ip = $_SERVER['REMOTE_ADDR']; // User's IP address
		$user_id = 'user123'; // Your user identifier

		$api = new ShortlinkAPI($api_key, $user_id, $user_ip, $bearer_token);
		$result = $api->getData();

		if($result && $result['status'] == 200) {
		  foreach($result['data'] as $link) {
			echo $link['title'] . "\n";
			echo $link['reward'] . "\n";
			echo $link['available'] . "\n";
			echo $link['url'] . "\n";
			echo "---------------\n";
		  }
		} else {
		  echo "Request failed";
		}
		  

Error Handling

When an error occurs, the API will return an error response with appropriate status code:


		{
		  "status": 401,
		  "error": "missing_header",
		  "message": "Missing Authorization header"
		}
		  

Common error codes:

Status Code Error Description
401 missing_header Authorization header is missing
401 invalid_token Bearer token is invalid or expired
403 access_denied Offerwall is not valid or API access is disabled
400 access_denied VPN/Proxy detected or IP is blocked

Integrate Offerwall

Our Offerwall enables users to benefit from incentives and rewards thanks to segmented, automatically translated ads. Our offerwall will adapt to any screen and will show offers to your users.

Before being able to integrate our offerwall, you must register your website first. Once you have registered your website you will have an API KEY and a SECRET KEY, that you will need in the following steps.

  1. Click on My Websites button on sidebar.
  2. From your websites list, you can get your API and Secret keys, anyway if you click Edit button on any of your websites you will be able to get your full integration code of the offerwall.


    From your website overview, you can get the offerwall code by clicking on Get Offerwall Code button. You just need to copy the code on your website.

Website Integration

If you are looking to integrate the offerwall into your website, either open the offerwall in a new tab (for example using the JavaScript command below) or show the offerwall in an iFrame.

JavaScript Integration
window.open("https://ewall.biz/offerwall/[API_KEY]/[USER_ID]")
iFrame Integration
<iframe scrolling="yes" 
		  

Offerwall Code

<iframe style="width:100%;height:800px;border:0;padding:0;margin:0;" scrolling="yes" 
frameborder="0" src="https://ewall.biz/offerwall/[API_KEY]/[USER_ID]"></iframe>

Replace [API_KEY] with your website api key and [USER_ID] by the unique identifier code of the user of your site who is viewing the wall.

Android Integration

If you are looking to integrate the offerwall into your Android app, either open the offerwall in Google Chrome or use a web view to show the offerwall inside your app.

URL
https://ewall.biz/offerwall/[API_KEY]/[USER_ID]
WebView Example
WebView myWebView = new WebView(activityContext);
setContentView(myWebView);

WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);

myWebView.loadUrl("https://ewall.biz/offerwall/[API_KEY]/[USER_ID]");

Replace [API_KEY] with your website api key and [USER_ID] by the unique identifier code of the user of your site who is viewing the wall.

iOS Integration

If you are looking to integrate the offerwall into your iOS app, either open the offerwall in Safari or use a web view to show the offerwall inside your app.

URL
https://ewall.biz/offerwall/[API_KEY]/[USER_ID]
WebView Example
import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {

   var webView: WKWebView!

   override func loadView() {
       let webConfiguration = WKWebViewConfiguration()
       webView = WKWebView(frame: .zero, configuration: webConfiguration)
       webView.uiDelegate = self
       view = webView
   }
   override func viewDidLoad() {
       super.viewDidLoad()
       let myURL = URL(string:"https://ewall.biz/offerwall/[API_KEY]/[USER_ID]")
       let myRequest = URLRequest(url: myURL!)
       webView.load(myRequest)
   }}

Replace [API_KEY] with your website api key and [USER_ID] by the unique identifier code of the user of your site who is viewing the wall.

React Native

If you are looking to integrate the offerwall into your React Native app, either open the offerwall in the default browser of the user with the Linking-API or use react-native-webview to show the offerwall inside your app.

Linking
import { Linking } from 'react-native';
Linking.openURL('https://ewall.biz/offerwall/[API_KEY]/[USER_ID]');
React Native WebView
/*
  Add react-native-webview to your dependencies. Using Yarn:
	yarn add react-native-webview
  Using npm:
	npm install --save react-native-webview
  Using Expo:
	npx expo install react-native-webview
*/
import { WebView } from 'react-native-webview';
return <WebView source={{ uri: 'https://ewall.biz/offerwall/[API_KEY]/[USER_ID]' }} />;

Replace [API_KEY] with your website api key and [USER_ID] by the unique identifier code of the user of your site who is viewing the wall.

Offerwall Parameters

Bellow you can see parameters supported by our offerwall. Make sure you properly replace them during your offerwall integration.

Parameter Description Value
[API_KEY] Unique API Code provided when you registered your website varchar(32)
[USER_ID] Unique identifier code of the user of your site varchar(32)

Postback Notifications

Whenever a user complete an offer, we will make a call to the Postback URL that you indicated in your app attaching all the information that you will need to credit your users.

Our server will make a HTTP POST request to your server including all of the following parameters.

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. Ewall - Register and Earn
offer_type Type of the offer completed by user (ptc, offer, task, shortlink). ptc
reward The 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)
debug Check if is a test or a live postback call. 1 (test) / 0 (live)
signature MD5 hash that can be used to verify that the call has been made from our servers. 17b4e2a70d6efe9796dd4c5507a9f9ab

"reward" and "payout" parameters are always absolute values, you will need to check status parameter to see if you need to add or subtract that amount from your users.

Postback Security

You should verify the signature received in the postback to ensure that the call comes from our servers.
Signature parameter should match MD5 of subId transactionId reward secret key. You can find your Secret Key of your website in My Websites section.

The formula to be checked is as follows:

<?php
  $secret = ""; // Get your secret key from Ewall

  $subId = isset($_REQUEST['subId']) ? $_REQUEST['subId'] : null;
  $transId = isset($_REQUEST['transId']) ? $_REQUEST['transId'] : null;
  $reward = isset($_REQUEST['reward']) ? $_REQUEST['reward'] : null;
  $signature = isset($_REQUEST['signature']) ? $_REQUEST['signature'] : null;

  // Validate Signature
  if(md5($subId.$transId.$reward.$secret) != $signature)
  {
   echo "ERROR: Signature doesn't match";
   return;
  }
?>

Our servers wait for a response for a maximum time of 60 seconds before the timeout. In this case, postback will be marked as failed. Please, check if the transaction ID sent to you was already entered in your database, this will prevent to give twice the same amount of virtual currency to the user.

Respond to Postback

Our servers will expect your website to respond with "ok". If your postback doesn't return "ok" as response, postback will be marked as failed (even if postback was successfully called) and you will be able to resend it manually from our website.

Postback Example

The following PHP example is not a working one but should be enough to understand how you should implement your postback in your website.

<?php
  $secret = ""; // Get your secret key from Ewall

  // Proceess only requests from Ewall IP addresses
  $allowed_ips = array('23.95.130.144','173.249.37.16','107.173.28.51');
  if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
  {
   $IP = $_SERVER['HTTP_X_FORWARDED_FOR']; 
  }
  else 
  { 
   $IP = $_SERVER['REMOTE_ADDR'];
  }

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

  // Get postback variables
  $userId = isset($_REQUEST['subId']) ? $_REQUEST['subId'] : null;
  $transId = isset($_REQUEST['transId']) ? $_REQUEST['transId'] : null;
  $reward = isset($_REQUEST['reward']) ? $_REQUEST['reward'] : null;
  $reward_name = isset($_REQUEST['reward_name']) ? $_REQUEST['reward_name'] : null;
  $reward_value = isset($_REQUEST['reward_value']) ? $_REQUEST['reward_value'] : null;
  $offer_name = isset($_REQUEST['offer_name']) ? $_REQUEST['offer_name'] : null;
  $offer_type = isset($_REQUEST['offer_type']) ? $_REQUEST['offer_type'] : null;
  $payout = isset($_REQUEST['payout']) ? $_REQUEST['payout'] : null;
  $ipuser = isset($_REQUEST['userIp']) ? $_REQUEST['userIp'] : "0.0.0.0";
  $country = isset($_REQUEST['country']) ? $_REQUEST['country'] : null;
  $status = isset($_REQUEST['status']) ? $_REQUEST['status'] : null;
  $debug = isset($_REQUEST['debug']) ? $_REQUEST['debug'] : null;
  $signature = isset($_REQUEST['signature']) ? $_REQUEST['signature'] : null;

  // Validate signature
  if(md5($userId.$transId.$reward.$secret) != $signature)
  {
    echo "ERROR: Signature doesn't match";
    return;
  }

  // Add or substract the reward
  if($status == 2)
  {
    //  2 = Chargeback, substract reward from user
    $reward = -abs($reward);
  }

   // Check if the transaction is new, use $transId to valiate it
  if(isNewTransaction($transId))
  { 
    // Transaction is new, reward your user
    processTransaction($userId, $reward, $transId);
  }
  else
  {
    // This transaction already exist
  }

  echo "ok"; // Important!
?>

Intregrate Offerwall on Best Faucet Scripts

We have provide you some Best Faucet scripts intregartion method here,with this tutorial any faucet owner can easyly intregrate on there script

For evolution script you can find here the integration example!
Download link


Vie Faucet API Integration

PTC API Integration for Vie Script

If you want to take PTC campaign data directly, and adjust its appearance to the appearance of your website.

Our server will return with the following JSON Response.


	{
		"status": "200",
		"message": "success",
		"data": [{
			"id": "8098",
			"image": "",
			"title": "Free spin, win BTC! Up to 5 BTC daily! \ud83e\udd11",
			"description": "760% deposit bonus! Earn While Playing!",
			"duration": "30",
			"reward": "600.00",
			"currency_name": "Cash",
			"url": "https:\/\/ewall.biz\/view\/eHpzcjlteGJreGx3cHE0bnw0NTUyfG96YWJ2bHhieXJkeXYyOW5jeWJkcDc0NjRyODJyaQ==",
			"boosted_campaign": false,
			"ad_type": "Iframe"
		}, {
			"id": "11206",
			"image": "https:\/\/ewall.biz\/files\/ptc\/ptc-1-qgow52jm.png",
			"title": "Ewall BLOG",
			"description": "Check out the new Ewall blog",
			"duration": "10",
			"reward": "40.00",
			"currency_name": "Cash",
			"url": "https:\/\/ewall.biz\/view\/eHNueHQ0aXliMnZydG9kYXw0NTUyfG96YWJ2bHhieXJkeXYyOW5jeWJkcDc0NjRyODJyaQ==",
			"boosted_campaign": false,
			"ad_type": "Window"
		}]
	}
	
PTC Controller Example

		class PtcController extends Controller {
			private $api_key = '[API_KEY]';
			private $bearer_token = '[ACCESS_TOKEN]';

			private function requestWithFileContents($url, $token) {
				$options = [
					'http' => [
						'header' => "Authorization: Bearer $token\r\n",
						'timeout' => 10
					]
				];
				return @file_get_contents($url, false, stream_context_create($options));
			}

			private function requestWithCurl($url, $token) {
				$ch = curl_init();
				curl_setopt_array($ch, [
					CURLOPT_URL => $url,
					CURLOPT_RETURNTRANSFER => true,
					CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"],
					CURLOPT_TIMEOUT => 10
				]);
				$response = curl_exec($ch);
				if(curl_errno($ch)) {
					$response = false;
				}
				curl_close($ch);
				return $response;
			}

			private function getEwallPtc($user_id, $ip_address) {
				$url = 'https://ewall.biz/api/'.$this->api_key.'/'.$user_id.'/'.$ip_address;
				
				// Try file_get_contents first
				$response = $this->requestWithFileContents($url, $this->bearer_token);
				
				// If failed, try curl
				if($response === false) {
					$response = $this->requestWithCurl($url, $this->bearer_token);
				}

				if($response) {
					$data = json_decode($response, true);
					if(isset($data['status']) && $data['status'] == 200) {
						return [
							'success' => true,
							'data' => $data['data']
						];
					}
					return [
						'success' => false,
						'message' => $data['message'] ?? 'Unknown error'
					];
				}
				
				return [
					'success' => false,
					'message' => 'Request failed'
				];
			}

			public function index() {
				$data = [
					'page' => 'Paid To Click',
					'totalReward' => 0
				];

				// Get local PTC ads
				$ptcAds = $this->m_ptc->availableAds($this->data['user']['id']);
				$data['ptcAds'] = $ptcAds;
				$data['totalAds'] = count($ptcAds);

				// Calculate total reward
				foreach($ptcAds as $ad) {
					$data['totalReward'] += $ad['reward'];
				}

				// Get Ewall PTC ads
				$ewallPtc = $this->getEwallPtc(
					$this->data['user']['id'],
					$this->input->ip_address()
				);

				if($ewallPtc['success']) {
					$data['Ewall_ptc'] = $ewallPtc['data'];
				} else {
					$data['error_message'] = $ewallPtc['message'];
				}

				// Render view
				$this->render('ptc', $data);
			}
		}
	

Replace [API_KEY] with your website api key, [BEARER_TOKEN] with your website's generated token, you can generate your Bearer Token when you edit your app.

Shortlink API Integration for Vie Script

If you want to take Shortlink data directly, and adjust its appearance to the appearance of your website.

Our server will return with the following JSON Response.


	{
		"status": "200",
		"message": "success",
		"data": [{
			"id": "1",
			"title": "shortlink1",
			"reward": "600.00",
			"currency_name": "Cash",
			"completion_rate": "100.00",
			"available": "2",
			"limit": "2",
			"url": "https:\/\/ewall.biz\/start\/eHpzcjlteGJreGx3cHE0bnw0NTUyfG96YWJ2bHhieXJkeXYyOW5jeWJkcDc0NjRyODJyaQ==",
			"boosted_campaign": false,
		}, {
			"id": "2",
			"title": "shortlink2",
			"reward": "600.00",
			"currency_name": "Cash",
			"completion_rate": "70.50",
			"available": "3",
			"limit": "5",
			"url": "https:\/\/ewall.biz\/start\/eHNueHQ0aXliMnZydG9kYXw0NTUyfG96YWJ2bHhieXJkeXYyOW5jeWJkcDc0NjRyODJyaQ==",
			"boosted_campaign": false,
		}]
	}
	
Shortlink Controller Example

		class ShortlinkController extends Controller {
			private $api_key = '[API_KEY]';
			private $bearer_token = '[ACCESS_TOKEN]';

			private function requestWithFileContents($url, $token) {
				$options = [
					'http' => [
						'header' => "Authorization: Bearer $token\r\n",
						'timeout' => 10
					]
				];
				return @file_get_contents($url, false, stream_context_create($options));
			}

			private function requestWithCurl($url, $token) {
				$ch = curl_init();
				curl_setopt_array($ch, [
					CURLOPT_URL => $url,
					CURLOPT_RETURNTRANSFER => true,
					CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"],
					CURLOPT_TIMEOUT => 10
				]);
				$response = curl_exec($ch);
				if(curl_errno($ch)) {
					$response = false;
				}
				curl_close($ch);
				return $response;
			}

			private function getEwallShortlinks($user_id, $ip_address) {
				$url = 'https://ewall.biz/sl-api/'.$this->api_key.'/'.$user_id.'/'.$ip_address;
				
				// Try file_get_contents first
				$response = $this->requestWithFileContents($url, $this->bearer_token);
				
				// If failed, try curl
				if($response === false) {
					$response = $this->requestWithCurl($url, $this->bearer_token);
				}

				if($response) {
					$data = json_decode($response, true);
					if(isset($data['status']) && $data['status'] == 200) {
						return $data['data'];
					}
					return ['error' => $data['message'] ?? 'Unknown error'];
				}
				
				return ['error' => 'Request failed'];
			}

			public function index() {
				// Page data
				$data = [
					'page' => 'Shortlinks Wall',
					'totalReward' => 0,
					'totalEnergy' => 0
				];

				// Get available links
				$availableLinks = $this->m_links->availableLinks($this->data['user']['id']);
				
				// Calculate rewards and energy
				foreach($availableLinks as &$link) {
					$countHistory = $this->m_links->countHistory($this->data['user']['id'], $link['id']);
					$link['rmnViews'] = $link['view_per_day'] - $countHistory;
					$data['totalReward'] += $link['rmnViews'] * $link['reward'];
					$data['totalEnergy'] += $link['rmnViews'] * $link['energy'];
				}

				// Sort links
				usort($availableLinks, 'compare_links');
				$data['availableLinks'] = $availableLinks;

				// Get Ewall shortlinks
				$ewallLinks = $this->getEwallShortlinks(
					$this->data['user']['id'], 
					$this->input->ip_address()
				);

				if(isset($ewallLinks['error'])) {
					$data['error_message'] = $ewallLinks['error'];
				} else {
					$data['Ewall_sl'] = $ewallLinks;
				}

				// Render view
				$this->render('links', $data);
			}
		}
	

Replace [API_KEY] with your website api key, [BEARER_TOKEN] with your website's generated token, you can generate your Bearer Token when you edit your app.


Vie Faucet 4.3 Integration

It takes only three steps to integrate Ewall offerwall into your VieFaucet script.Please find below steps.

First open file - application/controllers/wh.php and enter the following code before last closing bracket (}).

Do not forget to enter your secret key under variable $secret from the Ewall's dashboard. Otherwise,your users will not be credited properly since postback will not work.


				 public function ewall()
			  {
				     $secret = ""; // UPDATE YOUR SECRET KEY
				     $hold = 3;  // UPDATE HOLD DAYS IF YOU USE HOLD
				     $minHold= 0.5; // Reward Lower than this amount will not be hold
				    
				     $userId = isset($_REQUEST['subId']) ? $this->db->escape_str($_REQUEST['subId']) : null;
				     $transactionId = isset($_REQUEST['transId']) ? $this->db->escape_str($_REQUEST['transId']) : null;
				     $reward = isset($_REQUEST['reward']) ? $this->db->escape_str($_REQUEST['reward']) : null;
				     $action = isset($_REQUEST['status']) ? $this->db->escape_str($_REQUEST['status']) : null;
				     $userIp = isset($_REQUEST['userIp']) ? $this->db->escape_str($_REQUEST['userIp']) : "0.0.0.0";
				     $signature = isset($_REQUEST['signature']) ? $this->db->escape_str($_REQUEST['signature']) : null;
				     if (md5($userId . $transactionId . $reward . $secret) != $signature) {
				     echo "ERROR: Signature doesn't match";
				     return;
				     }
				    
				     $reward = $reward * $this->data['settings']['currency_rate'];
				    
				     $trans = $this->m_offerwall->getTransaction($transactionId, 'Ewall');
				     if ($action == 2) {
				     $this->m_offerwall->reduceUserBalance($userId, abs($reward));
				     $this->m_offerwall->insertTransaction($userId, 'Ewall', $userIp, $reward, $transactionId, 1, time());
				     echo "ok";
				     } else {
				     if (!$trans) {
				     $hold = 0;
				     if ($reward > $minHold) {
				         $hold = 3; // UPDATE HOLD DAYS Which you Use for hold
				     	}
				    
				     if ($hold == 0) {
				     $offerId = $this->m_offerwall->insertTransaction($userId, 'Ewall', $userIp, $reward, $transactionId, 2, time());
				     $this->m_offerwall->updateUserBalance($userId, $reward);
				     $this->m_core->addNotification($userId, currency($reward, $this->data['settings']['currency_rate']) . " from Ewall Offer #" . $offerId . " was credited to your balance.", 1);
				    
				     $user = $this->m_core->get_user_from_id($userId);
				     $this->m_core->addExp($user['id'], $this->data['settings']['offerwall_exp_reward']);
				     if (($user['exp'] + $this->data['settings']['offerwall_exp_reward']) >= ($user['level'] + 1) * 100) {
				     $this->m_core->levelUp($user['id']);
				     }
				     } else {
				     $availableAt = time() + $hold * 86400;
				     $offerId = $this->m_offerwall->insertTransaction($userId, 'Ewall', $userIp, $reward, $transactionId, 0, $availableAt);
				     $this->m_core->addNotification($userId, "Your Ewall Offer #" . $offerId . " is pending approval.", 0);
				     }
				     echo "ok";
				     } else {
				     echo "DUP";
				     }
				   }
			    }	
				
				
				

Second step is to add our offerwall in the UI. Inside application/controllers/offerwall.php file, add this code before last closing bracket (}).

Don't forget to place on proper place your API key from the dashboard under $api_key variable.


				    public function ewall()
			  {
				  $api_key=""; // UPDATE YOUR API KEY HERE
				 $this->data['page'] = 'Ewall Offerwall';
				 $this->data['iframe'] = '<iframe style="width:100%;height:800px;border:0;padding:0;margin:0;" scrolling="yes" frameborder="0" src="https://ewall.biz/offerwall/' . $api_key . '/' . $this->data['user']['id'] . '"></iframe>';
				 $this->data['wait'] = 3; // UPDATE YOUR HOLD TIME
				 $this->render('offerwall', $this->data);
			 }
				  
				  

Third step is to add Ewall's offerwall inside your sidebar/ UserPanel Menu on Vie Faucet.

Go to this file application/views/user_template/template.php, and place this code above or under some of the existing offerwalls list.


			<li><a href="<?= site_url('offerwall/ewall') ?>" key="t-ewall">Ewall</a></li>
				  
				  

Final Step You must Add below code on your config files

Open Application/Config/config.php

Goto $config['csrf_exclude_uris'] this line

Add this code 'wh/ewall', on that line.

How to set site on Ewall?

PostBack URL Should be : https://yourdomain.com/wh/ewall


Vie Faucet 4.4 Integration

It takes only three steps to integrate Ewall offerwall into your VieFaucet script.Please find below steps.

First open file - application/controllers/wh.php and enter the following code before last closing bracket (}).

Do not forget to enter your secret key under variable $secret from the Ewall's dashboard. Otherwise,your users will not be credited properly since postback will not work.


				 public function ewall()
			  {
				     $secret = ""; // UPDATE YOUR SECRET KEY
				     $hold = 3;  // UPDATE HOLD DAYS IF YOU USE HOLD
				     $minHold= 0.5; // Reward Lower than this amount will not be hold
				    
				     $userId = isset($_REQUEST['subId']) ? $this->db->escape_str($_REQUEST['subId']) : null;
				     $transactionId = isset($_REQUEST['transId']) ? $this->db->escape_str($_REQUEST['transId']) : null;
				     $reward = isset($_REQUEST['reward']) ? $this->db->escape_str($_REQUEST['reward']) : null;
				     $action = isset($_REQUEST['status']) ? $this->db->escape_str($_REQUEST['status']) : null;
				     $userIp = isset($_REQUEST['userIp']) ? $this->db->escape_str($_REQUEST['userIp']) : "0.0.0.0";
				     $signature = isset($_REQUEST['signature']) ? $this->db->escape_str($_REQUEST['signature']) : null;
				     if (md5($userId . $transactionId . $reward . $secret) != $signature) {
				     echo "ERROR: Signature doesn't match";
				     return;
				     }
				    
				     $reward = $reward * $this->data['settings']['currency_rate'];
				    
				     $trans = $this->m_offerwall->getTransaction($transactionId, 'Ewall');
				     if ($action == 2) {
				     $this->m_offerwall->reduceUserBalance($userId, abs($reward));
				     $this->m_offerwall->insertTransaction($userId, 'Ewall', $userIp, $reward, $transactionId, 1, time());
				     echo "ok";
				     } else {
				     if (!$trans) {
				     $hold = 0;
				     if ($reward > $minHold) {
				         $hold = 3; // UPDATE HOLD DAYS Which you Use for hold
				     	}
				    
				     if ($hold == 0) {
				     $offerId = $this->m_offerwall->insertTransaction($userId, 'Ewall', $userIp, $reward, $transactionId, 2, time());
				     $this->m_offerwall->updateUserBalance($userId, $reward);
				     $this->m_core->addNotification($userId, currencyDisplay($reward, $this->data['settings']) . " from Ewall Offer #" . $offerId . " was credited to your balance.", 1);
				    
				     $user = $this->m_core->getUserFromId($userId);
				     $this->m_core->addExp($user['id'], $this->data['settings']['offerwall_exp_reward']);
				     if (($user['exp'] + $this->data['settings']['offerwall_exp_reward']) >= ($user['level'] + 1) * 100) {
				     $this->m_core->levelUp($user['id']);
				     }
				     } else {
				     $availableAt = time() + $hold * 86400;
				     $offerId = $this->m_offerwall->insertTransaction($userId, 'Ewall', $userIp, $reward, $transactionId, 0, $availableAt);
				     $this->m_core->addNotification($userId, "Your Ewall Offer #" . $offerId . " is pending approval.", 0);
				     }
				     echo "ok";
				     } else {
				     echo "DUP";
				     }
				   }
			    }	
				
				
				

Second step is to add our offerwall in the UI. Inside application/controllers/offerwall.php file, add this code before last closing bracket (}).

Don't forget to place on proper place your API key from the dashboard under $api_key variable.


				    public function ewall()
			  {
				  $api_key = ""; // UPDATE YOUR API KEY HERE
				 $this->data['page'] = 'Ewall Offerwall';
				 $this->data['iframe'] = '<iframe style="width:100%;height:800px;border:0;padding:0;margin:0;" scrolling="yes" frameborder="0" src="https://ewall.biz/offerwall/' . $api_key . '/' . $this->data['user']['id'] . '"></iframe>';
				 $this->data['wait'] = 3; // UPDATE YOUR HOLD TIME
				 $this->render('offerwall', $this->data);
			 }
				  
				  

Third step is to add Ewall's offerwall inside your sidebar/ UserPanel Menu on Vie Faucet.

Go to this file application/views/user_template/template.php, and place this code above or under some of the existing offerwalls list.


			<li><a href="<?= site_url('offerwall/ewall') ?>" key="t-ewall">Ewall</a></li>
				  
				  

Final Step You must Add below code on your config files

Open Application/Config/config.php

Goto $config['csrf_exclude_uris'] this line

Add this code 'wh/Ewall', on that line.

How to set site on Ewall?

PostBack URL Should be : https://yourdomain.com/wh/ewall


CryptoFaucet/ClaimBits Integration

ClaimBits/CryptoFaucet is a Very populer of Crypto Faucet which brings plenty of different features together into a complete system.

Ewall integration is very easy in this script - Just need to create 1 file, Modify 2 line of code, and that’s it! Less than 5 minutes and you can bring Ewall offerwall to your users.

To create Postback file - open system/gateways/ and create file ewall.php, put following code in this file:

                  
       <?php
        define('BASEPATH', true);
        require('../init.php');
        $secret = "YOUR SECRET KEY"; //Enter Your Ewall SECRET KEY
        
        $userId = isset($_REQUEST['subId']) ? $db->EscapeString($_REQUEST['subId']) : null;
        $survey = isset($_REQUEST['transId']) ? $db->EscapeString($_REQUEST['transId']) : null;
        $reward = isset($_REQUEST['reward']) ? $db->EscapeString($_REQUEST['reward']) : null;
        $payout = isset($_REQUEST['payout']) ? $db->EscapeString($_REQUEST['payout']) : null;
        $action = isset($_REQUEST['status']) ? $db->EscapeString($_REQUEST['status']) : null;
        $userIP = isset($_REQUEST['userIp']) ? $db->EscapeString($_REQUEST['userIp']) : '0.0.0.0';
        $country = isset($_REQUEST['country']) ? $db->EscapeString($_REQUEST['country']) : null;
        
        if (md5($userId.$survey.$reward.$secret) != $_REQUEST['signature']){
        echo "ERROR: Signature doesn't match";
        return;
        }
        if(!empty($userId) && $db->QueryGetNumRows("SELECT * FROM `completed_offers` WHERE `survey_id`='".$survey."' LIMIT 1") == 0)
        {
        $user = $db->QueryFetchArray("SELECT `id` FROM `users` WHERE `id`='".$userId."'");
        if(!empty($user['id'])) {
        $tc_points = (0.10*($payout*100));
        $tc_points = ($tc_points < 1 ? 1 : number_format($tc_points, 0));
        $db->Query("UPDATE `users` SET `ow_credits`=`ow_credits`+'".$reward."', `tasks_contest`=`tasks_contest`+'".$tc_points."' WHERE `id`='".$user['id']."'"); 
        $db->Query("INSERT INTO `users_offers` (`uid`,`total_offers`,`total_revenue`,`last_offer`) VALUES ('".$user['id']."','1','".$reward."','".time()."') ON DUPLICATE KEY UPDATE `total_offers`=`total_offers`+'1', `total_revenue`=`total_revenue`+'".$reward."', `last_offer`='".time()."'");
        $db->Query("INSERT INTO `completed_offers` (`user_id`,`survey_id`,`user_country`,`user_ip`,`revenue`,`reward`,`method`,`timestamp`) VALUES ('".$user['id']."','".$survey."','".$country."','".ip2long($userIP)."','".$payout."','".$reward."','Ewall','".time()."')");
        }
     }  
        echo 'ok';
       
       ?>
      
    

HOLA...Your, postback created Suceesfully! Now is time for iframe integration

Just Open template/default/pages/offers.php, and add the following code after some of the existing offerwalls. break; code.

    
           case 'ewall' :
           $title = 'Ewall';
           $offer_wall = '<iframe src="https://ewall.biz/offerwall/YOUR API KEY/'.$data['id'].'" style="width:100%;height:690px;border:0;border-radius:5px;"></iframe>';
            break;
    
    

.Replace YOUR API KEY by your Ewall API key from Ewall Website setting.

Scroll down and insert link to Ewall offerwall:

            
                 <a href="<?php echo GenerateURL('offers&x=ewall'); ?>" class="btn btn-secondary mb-1<?php echo ($method == 'ewall' ? ' active' : ''); ?>">Ewall</a>
                
                

And save, that is all!

What POSTBACK URL YOU NEED TO UPDATE IN Ewall POSTBACK URL?

Note: Currency should be set in credits

Postback URL should be : http://yourdomain.com/system/gateways/ewall.php


AutoFaucetScript - Ultimate Auto Faucet By NGB Solutions Integration

AutoFaucetScript is a Very populer of New Mordern AutoFaucet Script which brings plenty of different features together into a complete system.

Ewall integration is very easy in this script - Just need to create 1 file, Modify 2 line of code, and that’s it! Less than 5 minutes and you can bring Ewall offerwall to your users.

To create Postback file - open system/gateways/ and create file ewall.php, put following code in this file:

                  
       <?php
        define('BASEPATH', true);
        require('../init.php');
        $secret = "YOUR SECRET KEY"; //Enter Your Ewall SECRET KEY
        
        $userId = isset($_REQUEST['subId']) ? $db->EscapeString($_REQUEST['subId']) : null;
        $survey = isset($_REQUEST['transId']) ? $db->EscapeString($_REQUEST['transId']) : null;
        $reward = isset($_REQUEST['reward']) ? $db->EscapeString($_REQUEST['reward']) : null;
        $payout = isset($_REQUEST['payout']) ? $db->EscapeString($_REQUEST['payout']) : null;
        $action = isset($_REQUEST['status']) ? $db->EscapeString($_REQUEST['status']) : null;
        $userIP = isset($_REQUEST['userIp']) ? $db->EscapeString($_REQUEST['userIp']) : '0.0.0.0';
        $country = isset($_REQUEST['country']) ? $db->EscapeString($_REQUEST['country']) : null;
        
        if (md5($userId.$survey.$reward.$secret) != $_REQUEST['signature']){
        echo "ERROR: Signature doesn't match";
        return;
        }
        if(!empty($userId) && $db->QueryGetNumRows("SELECT * FROM `completed_offers` WHERE `survey_id`='".$survey."' LIMIT 1") == 0)
        {
        $user = $db->QueryFetchArray("SELECT `id` FROM `users` WHERE `id`='".$userId."'");
        if(!empty($user['id'])) {
        $currentPrice = $db->QueryFetchArray("SELECT `value` FROM `bitcoin_price` ORDER BY `time` DESC LIMIT 1");
        $usdPayout = $currentPrice['value']*$payout;
        $tc_points = (0.10*$usdPayout);
        $tc_points = ($tc_points < 1 ? 1 : number_format($tc_points, 0));
        $db->Query("UPDATE `users` SET `ow_credits`=`ow_credits`+'".$reward."', `tasks_contest`=`tasks_contest`+'".$tc_points."' WHERE `id`='".$user['id']."'"); 
        $db->Query("INSERT INTO `users_offers` (`uid`,`total_offers`,`total_revenue`,`last_offer`) VALUES ('".$user['id']."','1','".$reward."','".time()."') ON DUPLICATE KEY UPDATE `total_offers`=`total_offers`+'1', `total_revenue`=`total_revenue`+'".$reward."', `last_offer`='".time()."'");
        $db->Query("INSERT INTO `completed_offers` (`user_id`,`survey_id`,`user_country`,`user_ip`,`revenue`,`reward`,`method`,`timestamp`) VALUES ('".$user['id']."','".$survey."','".$country."','".ip2long($userIP)."','".$usdPayout."','".$reward."','Ewall','".time()."')");
        }
     }  
        echo 'ok';
       
       ?>
      
    

HOLA...Your, postback created Suceesfully! Now is time for iframe integration

Just Open template/default/pages/offers.php, and add the following code after some of the existing offerwalls. break; code.

    
           case 'ewall' :
           $title = 'Ewall';
           $offer_wall = '<iframe src="https://ewall.biz/offerwall/YOUR API KEY/'.$data['id'].'" style="width:100%;height:690px;border:0;border-radius:5px;"></iframe>';
            break;
    
    

💡.Replace YOUR API KEY by your Ewall API key from Ewall Website setting.

Scroll down and insert link to Ewall offerwall:

            
                 <a href="<?php echo GenerateURL('offers&x=ewall'); ?>" class="btn btn-secondary mb-1<?php echo ($method == 'ewall' ? ' active' : ''); ?>">Ewall</a>
                
                

And save, that is all!

What POSTBACK URL YOU NEED TO UPDATE IN Ewall POSTBACK URL?

Note: Currency should be set in credits

Postback URL should be : http://yourdomain.com/system/gateways/ewall.php