Work with campaigns

Add action commission to a campaign via API

Here is an example of how you can add an action commission to a campaign via API: <?php //PapApi.class.php can be downloaded from the merchant panel: //Start > Tools > Integration > API Integration > Download PAP API // or can be found in the 'api' folder of your installation of Post Affiliate Pro include 'PapApi.class.php'; //log in as merchant $session = new Pap_Api_Session("https://yoursite.com/PostAffiliatePro/scripts/server.php"); if(!$session->login("merchant@userna...

How to get commissiontypeid for campaign and commissiontype

This example shows how to get commissiontypeid for certain campaign and commissiontype. When you create transaction using class Pap_Api_Transaction, you need know commissiontypeid. You can find it manually in Merchant panel: Start -> Campaigns manager -> Edit -> Commissions settings <?php include 'PapApi.class.php'; //the PapApi.class.php can be found at the PAP installation folder, in the 'api' directory //---------------------------------------------- // login (as mercha...

Add campaign through API

Here is an example code which you can use to create campaign in your Post Affiliate Pro through API: <?php include 'PapApi.class.php'; //this include assumes the PapApi.class.php is in the same directory as this api script itself $session = new Pap_Api_Session("https://URL_TO_YOUR_PAP_INSTALLATION/scripts/server.php"); //log in as merchant if(!@$session->login("merchant username","merchant password")) { die("Cannot login. Message: ". $session->getMessage()); } $request = new Gpf_R...

Loading campaigns

If you want to load campaigns grid, you can use this example: <?php include 'PapApi.class.php'; //the PapApi.class.php can be downloaded from Tools->Integration->API->Download PapApi.class.php $session = new Pap_Api_Session("https://your_pap_url/scripts/server.php"); if(!$session->login("merchant login","password")) { die("Cannot login. Message: ". $session->getMessage()); } $request = new Gpf_Rpc_GridRequest("Pap_Merchants_Campaign_CampaignsGrid", "getRows", $session); $...

Configuring campaign commissions via API

After you add a campaign via API (https://support.qualityunit.com/468152-Add-campaign-through-API) it is essential to configure its commissions. Here is a sample script how to configure a campaign's commission structure (the default commission group) -- Sale or Click commission. If you wish to add an action commission (https://support.qualityunit.com/131732-Action-Commissions) to a campaign via API then check the notes below this sample code or click here (#actionCommission). <?php //y...

Display campaigns, commission groups and commission settings of an affiliate via API

This is a complete sample code that shows the campaigns, commission groups, and commission settings of the commission group in which a particular affiliate is involved. <?php //Download PapApi.class.php from the merchant panel: // Tools > Integration > API Integration > Download PAP API // the include_once below assumes the PapApi.class.php is in the same folder as this script include_once 'PapApi.class.php'; $papURL = "https://yoursite.com/pap"; //change it for the real URL of ...

Add product ID to existing campaign via API

The following code is an example of how to add product id(s) to an existing campaign. NOTE: it will replace the existing product IDs. If you wish to keep the existing product IDs, then first you have to load the campaign (https://support.qualityunit.com/295078-Loading-campaigns) and its product IDs and add them again along with the new product ids. <?php $papURL = "https://URL_TO_PAP"; //URL to PAP/PAN without trailing slash $merchantUsername = "merchant@username.com"; //replace with your ...

Display affiliates of a private campaign via API

The following sample code shows how to display the list of affiliates invited to a particular private campaign. <?php //the PapApi.class.php can be downloaded from the merchant panel: //Tools > Integration > API Integratoin > Download PAP API include_once 'PapApi.class.php'; //campaign ID (https://support.qualityunit.com/425816-How-do-I-find-a-campaign-ID-) of the particular private campaign $campaignID = '9e394454'; $session = new Pap_Api_Session("https://URL_TO_PAP/scripts/se...

Add commission group to a campaign via API

The following sample code shows how to add a commission group to a campaign. It behaves the same way as if you added a commission group to a campaign through the merchant panel, so the commission types that you already have in a campaign will be automatically created within the freshly added/created commission group. <?php //the PapApi.class.php can be downloaded from the merchant panel at Tools > Integration > API Integration > Download PAP API include 'PapApi.class.php'; //th...

Get the list of affiliates invited to any private campaign

This sample script shows the same result as the "Campaigns > Affiliates in campaigns" grid in the merchant panel. More exactly, it lists the affiliates and names of private (public with manual approval) campaigns the affiliates belong to. <?php // the PapApi.class.php file can be downloaded from the merchant panel at: // Tools > Integration > API Integration > Download PAP API // This include assumes the PapApi.class.php file is in the same directory as this particular script. ...

Load the whole Campaigns Categories tree

This is a sample code of how to load all [Campaigns Categories](https://support.qualityunit.com/268879-Campaigns-categories): <?php $papURL = "https://URL_TO_PostAffiliatePro"; //URL of your Post Affiliate Pro installation without any trailing slash $merchantUsername = "merchant@example.com"; //merchant username $merchantPassword = "123456"; //merchant password //your PapApi.class.php file can be downloaded in the merchant panel: //Tools>Integration>API Integration>Download PAP API...

Add (or remove) a campaign to Campaigns Categories

You can use the following code to add (or remove) a specific campaign to [Campaigns Categories](https://support.qualityunit.com/268879-Campaigns-categories). You'll need to know the IDs of the categories to which you want to add the campaign or remove it from, you can get these IDs by loading all the categories as explained [here](https://support.qualityunit.com/591172-Load-the-whole-Campaigns-Categories-tree). To add a campaign to a category you must set the category's "selected" attribute to ...
×