Work with commissions

How to get commission group id

Here is example how to retrieve the commission groupId for a campaign: <?php include 'PapApi.class.php'; //the PapApi.class.php can be found at the PAP installation folder, in the 'api' directory $session = new Pap_Api_Session("https://your_pap_url/scripts/server.php"); if(!$session->login("merchant login","pass")) { die("Cannot login. Message: ". $session->getMessage()); } $request = new Gpf_Rpc_Request("Pap_Merchants_Campaign_CommissionGroups","loadCommissionGroups",$session);...

Adding affiliate to commission group

First script shows how to add affiliate to commission group via API. Second script shows how to import commission groups from a .csv file. 1. This simple example assumes that you already know the desired affiliate id, campaign id and commission group id. <?php include 'affiliate/api/PapApi.class.php'; $session = new Pap_Api_Session("https://localhost/affiliate/scripts/server.php"); if(!$session->login("merchant@example.com", "demo")) { die("Cannot login. Message: ".$session->getMes...

Change status of a transaction

This example shows how to change the status of a transaction via API. Commission is found by trans action ID. If you want to only approve pending commissions by Order ID read this article: https://support.qualityunit.com/650825-Approvedecline-commissions-by-Order-ID <?php //the PapApi.class.php can be downloaded from the merchant panel of Post Affiliate Pro //at Start --> Tools > Integration > API Integration > Download PAP API include 'PapApi.class.php'; //---------------------...

Refund of a Transaction

Example code that loads transactions (even tier commissions) with the defined order ID and refunds them, which means that another transaction with the same order ID, total cost, but negative commission and with type of 'refund' will be created. <?php //----------------------------------------------------------------------- // PapApi.class.php can be downloaded from the merchant panel at: // Tools > Integration > API Integration > Download PAP API require_once 'PapApi.class.php'...

How to recompute transaction

This examples show how to recompute commission of transaction. If you know campaignid, userid, commissiontypeid you can compute commission so: <?php include 'PapApi.class.php'; //the PapApi.class.php can be found at the PAP installation folder, in the 'api' directory //---------------------------------------------- // login (as merchant) $session = new Pap_Api_Session("URL_to_PAP/scripts/server.php"); if(!$session->login("merchant@example.com","merchant_password")) { die("Cannot...

Get the list of recurring rules (recurring commissions)

The following API example shows how to obtain the unique IDs (or other details) of recurring rules that you see in the merchant panel at Transactions > Recurring commissions. <?php include_once ("PapApi.class.php"); //this include assumes the PapApi.class.php is in the same dir as this script //change localhost/pap to the path of your Post Affiliate Pro installation $session = new Pap_Api_Session("https://URL_TO_PAP/scripts/server.php"); //login as merchant if(!$session->login("mer...

Change the status of recurring rules via API

If you ever wanted to change the status of existing recurring rule found at Transactions > Recurring commissions via API, then the following sample script might come in handy: <?php include_once 'PapApi.class.php'; $papURL = "URL_TO_PostAffiliatePro"; //URL to Post Affliate Pro including protocol, but without any trailing slash $merchantUsername = "merchant@example.com"; //merchant username $merchantPassword = "123456"; //merchant password $session = new Pap_Api_Session($papURL."/scr...

Approve/decline commissions by Order ID

This is a sample code of how to approve or decline PENDING transactions by Order ID, it will approve all pending transactions with inserted Order ID (all tiers and all products), also transactions which are not processed by cron. Please note, that you can not use this script to decline approved transaction, or approve declined transaction. This script works and change the status of pending transactions only! If you want to change already approved or declined transaction, you need to use this A...
×