function onTP_ProcessSubmit($data, $vars) { //Take this receiver email address from plugin if component not provided it $plgPaymentAdaptivePaypalHelper = new plgPaymentAdaptivePaypalHelper(); $Fee = $plgPaymentAdaptivePaypalHelper->getFee($vars->order_id); $AmountToPayToPromoter = $vars->amount - $Fee; //create the pay request $createPacket = array("actionType" => "PAY", "currencyCode" => $vars->currency_code, "receiverList" => array("receiver" => array(array("amount" => $vars->amount, "email" => $this->params->get('business'), "primary" => "true"), array("amount" => $AmountToPayToPromoter, "email" => $vars->campaign_promoter, "primary" => "false"))), "returnUrl" => $vars->return, "cancelUrl" => $vars->cancel_return, "ipnNotificationUrl" => $vars->notify_url, "trackingId" => $vars->order_id, "requestEnvelope" => $this->envelope); $response = $this->_paypalSend($createPacket, "Pay"); //print_r($response);die; $paykey = $response['payKey']; //Set payment detials $detailsPacket = array("requestEnvelope" => $this->envelope, "payKey" => $response['payKey'], "receiverOptions" => array(array("receiver" => array("email" => $this->com_jgive_params->get('email'))), array("receiver" => array("email" => $vars->campaign_promoter)))); $response = $this->_paypalSend($detailsPacket, "SetPaymentOptions"); $detls = $this->getPaymentOptions($paykey); //header to paypal header("Location:" . $this->paypalurl . $paykey); }