Include API:
include_once('PapApi.class.php');
$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()); }
// loading affiliate by his ID $affiliate = new Pap_Api_Affiliate($session); // You can load affiliate by system user ID, referral ID or username, so one of the following commands $affiliate->setUserid("11111111"); //$affiliate->setUsername("my@username.com"); //$affiliate->setRefid("referralID"); try { if(!$affiliate->load()) { die('Cannot load affiliate, error: '.$affiliate->getMessage()); } } catch (Exception $e) { die('Cannot load affiliate, error: '.$e->getMessage()); }
$affiliate->setStatus('A'); //A - Approved, D - Declined, P - Pending try { if ($affiliate->save()) { echo "Affiliate saved successfully"; } else { die("Cannot save affiliate: ".$affiliate->getMessage()); } } catch (Exception $e) { die("Error while communicating with PAP: ".$e->getMessage()); }