How to get commission group id

Here is example how to retrieve the commission groupId for a campaign:

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);

// Set the campaign id for which we want the commission group

//insert here Commission Group Name, 'Default commission group' name is for default group
$groupName = 'Default commission group';

try  {
} catch(Exception $e){
  die("API call error: " . $e->getMessage());

$response = $request->getStdResponse();

foreach ($response as $responseItem) {
  if ($responseItem[1] == $groupName ) {
    $commissionGroupId = $responseItem[0];  }
echo $commissionGroupId;