Get the list of PAN Accounts via API

The following sample code shows how a network-owner can get the list of accounts of his/her Post Affiliate Network via API <?php //your PapApi.class.php file can be downloaded in the merchant panel: Tools>Integration>API Integration>Download PAP API include ("PapApi.class.php"); //this include assumes the PapApi.class.php is in the same dir as this script $session = new Pap_Api_Session("https://URL_TO_PAN/scripts/server.php"); //login as merchant if(!$session->login("network-...

PAN: change merchant password via API

The following script enables the network owner to change the password of any merchant belonging to his Post Affiliate Network via php API. <?php //your PapApi.class.php file can be downloaded in the merchant panel: //Tools > Integration > API Integration > Download PAP API //this include assumes the PapApi.class.php is in the same dir as this script include ("PapApi.class.php"); $panURL ="https://yoursite.com/PostAffiliateNetwork"; //URL to PAN without trailing slash // change i...

Approve affiliate with API

Following example shows, how you can approve pending affiliate using Post Affiliate Pro API. Include API: include_once('PapApi.class.php'); Login as merchant to get rights manipulating with Affiliate rows: $session = new Pap_Api_Session("https://demo.qualityunit.com/pax4/scripts/server.php"); if(!$session->login("merchant@example.com", "demo")) { die("Cannot login. Message: ".$session->getMessage()); } Load affiliate data: // loading affiliate by his ID $affiliate = new Pap_A...

PAN: Edit merchant info via API

The following sample script shows how to change the password of a network merchant via API. NOTE: it requires network-owner login credentials OR if another merchant would like to use it, he/she would have to have 'network owner privileges (https://support.qualityunit.com/067568-How-to-create-merchant-with-network-owner-privileges)'. <?php //your PapApi.class.php file can be downloaded in the merchant panel: //Tools>Integration>API Integration>Download PAP API include ("PapApi....

PAN: Add merchant account

This example shows how to add merchant account in Post Affiliate Network. <?php include 'PapApi.class.php'; //the PapApi.class.php can be downloaded from the merchant panel: Tools > Integration > API Integration > Download PAP API $session = new Pap_Api_Session("URL_to_PAP/scripts/server.php"); //---------------------------------------------- // login (as merchant / network owner) is not required, as this request is same as signup merchant account // but if you use captcha fo...

How to remove affiliates

If you want to remove affiliates via API, you can use method deleteRows in class Pap_Merchants_User_AffiliateForm. Deleting an affiliate will cause all his data (commissions, clicks, payout history, reports, etc...) to be deleted as well! Here is an example: <?php include 'PapApi.class.php'; //the PapApi.class.php can be found in your Post Affiliate Pro merchant panel>tools>Integration>API integration $session = new Pap_Api_Session("https://URL_OF_YOUR_POST_AFFILIATE_PRO_ACCOUNT...

Add affiliate

This example shows how to create a new affiliate, more about class Pap_Api_Affiliate you can read here (https://support.qualityunit.com/961744-Pap_Api_Affiliate) or about class Pap_Api_AffiliateSignup you can read here (https://support.qualityunit.com/397716-Pap_Api_AffiliateSignup). <?php include 'PapApi.class.php'; //Download PapApi.class.php from the merchant panel $session = new Pap_Api_Session("URL_to_PAP/scripts/server.php"); if(!@$session->login("merchant@example.com","merchant...

Get affiliate ID based on the visitor ID

Many times you will need to use affiliate ID but you only have visitor ID value from cookies. Use this example to help you to get the affiliate ID (or any other value) based on the visitor ID. <?php include 'PapApi.class.php'; //Download PapApi.class.php from the merchant panel $session = new Pap_Api_Session('https://www.yoursite.com/pap4/scripts/server.php'); if(!@$session->login("merchant@test.com","merchantpassword")) { die("Cannot login. Message: ". $session->getMessage())...

Display online users (merchants, affiliates) via API

The following script publishes the merchants, affiliates being logged in. <?php //---------------------------------------------- // PapApi.class.php 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 include 'api/PapApi.class.php'; //---------------------------------------------- // login (as merchant) $session = new Pap_Api_...

Display or update affiliate payout options via API

The following php API example shows how to update the payout option information of a particular affiliate. <?php //your PapApi.class.php file can be downloaded in the merchant panel: Tools>Integration>API Integration>Download PAP API include ("PapApi.class.php"); //this include assumes the PapApi.class.php is in the same dir as this script $papURL = "https://localhost/pap"; //URL leading to your Post Affiliate Pro (or Network) without trailing slash $merchantUsername = "test@mer...

Delete merchant via API

The following example shows how to delete a merchant via API, while we filter the merchant via his/her username (e-mail address) <?php //the PapApi.class.php can be downloaded from the merchant panel: //Tools > Integration > API Integratoin > Download PAP API include 'PapApi.class.php'; //---------------------------------------------- // login as main merchant or network-owner in case of PAN $session = new Pap_Api_Session("https://URL_TO_PAP/scripts/server.php"); if(!@$session-&...

Send password reset email to affiliate

If you have created external login forms for your affiliates you might also need an API solution to send out a password reset email to the affiliate. Below is the code with explanations in the comments which you might use to do just that. Important parts are highlighted. <?php //your PapApi.class.php file can be downloaded in the merchant panel: Tools>Integration>API Integration>Download PAP API include_once ("PapApi.class.php"); //this include assumes the PapApi.class.php is i...

Logging in the merchant and affiliate

Here is an example of one click login for merchant and affiliate using API. You can redirect automatically logged in affiliate to his/her panel. Logging in as merchant: include_once('PapApi.class.php'); $session = new Pap_Api_Session("https://demo.postaffiliatepro.com/scripts/server.php"); if(!@$session->login("merchant@example.com", "demo")) { die("Cannot login. Message: ".$session->getMessage()); } Logging in as merchant with 2FA token: $session = new Pap_Api_Session("https://dem...

How to automatically log in as an affiliate

You can do it using our API (https://support.qualityunit.com/712031-API): <?php /* *************** CONFIGURATION PART ****************** */ $papURL = 'https://URL_TO_PostAaffiliatePro/'; //URL of Post Affiliate Pro installation $mUsername = 'merchant@username.com'; //replace it with your merchant username $mPassword = '123456'; //replace it with your merchant password //username of the affiliate you want to log in with $usernameOfAffiliate = 'affiliate@example.com'; /* *************** /CONF...