Php 无法获取paypal返回值

Php 无法获取paypal返回值,php,paypal,phpfox,Php,Paypal,Phpfox,我的系统内置phpfox,有两种付款方式 一种是循环支付,另一种是平行支付 我无法在并行支付中获得返回值,但在循环选项中获得返回参数 下面是我在并行支付选项中获得的示例输出 Array ( [do] => /subscribe/complete/ [PHPSESSID] => 74b50226b0076bd66e1ddbc8baecd23d [corecf2bvisit] => 1400432842 [corecf2binvited_by_email_form] => a

我的系统内置phpfox,有两种付款方式

一种是循环支付,另一种是平行支付

我无法在并行支付中获得返回值,但在循环选项中获得返回参数

下面是我在并行支付选项中获得的示例输出

Array ( [do] => /subscribe/complete/ [PHPSESSID] => 74b50226b0076bd66e1ddbc8baecd23d [corecf2bvisit] => 1400432842 [corecf2binvited_by_email_form] => akhil@wdstech.com [corecf2bcur_mailid] => akhil@wdstech.com [corecf2binvited_by_user] => 0 [corecf2binvited_by_email] => 0 )
但我得到了返回值,包括循环选项中的金额

我该怎么解决呢

下面给出了我的代码的详细视图

public function getForm()
{       
    $bCurrencySupported = true;
    echo "<script>console.log('within-paypal')</script>";
    if (!in_array($this->_aParam['currency_code'], $this->_aCurrency))
    {
        if (!empty($this->_aParam['alternative_cost']))
        {
            $aCosts = unserialize($this->_aParam['alternative_cost']);
            foreach ($aCosts as $aCost)
            {
                $sCode = key($aCost);
                $iPrice = $aCost[key($aCost)];

                if (in_array($sCode, $this->_aCurrency))
                {
                    $this->_aParam['amount'] = $iPrice;
                    $this->_aParam['currency_code'] = $sCode;
                    $bCurrencySupported = false;
                    break;
                }
            }

            if ($bCurrencySupported === true)
            {
                return false;
            }
        }
        else
        {
            return false;
        }
    } #//by son
            $package_id = $this->_aParam['package_id']; //purchased package id - 2:Good Friend
            echo "<script>console.log('packageId-in-paypalclass-$package_id')</script>";
            if($package_id == 2){
                #//chk if its an upgrade
                $isUpgrad = $this->_aParam['is_upgrade'];
                if(isset($isUpgrad) && $isUpgrad==1){
                    return Phpfox_Error::display('Need invitation to upgrade to this subscription level!!');
                }
                #//get the details of the inviter users end */
                $pay_ids = $this->_aParam['pay_ids'];
                echo "<script>console.log('payid-count-".  count($pay_ids)."')</script>";
                #//echo '<pre>'; print_r($pay_ids); echo '</pre>';
                if($pay_ids[0] == 'admin'){
                    $rec_dtl[0]['rec_email'] = $this->_aParam['setting']['paypal_email'];
                    $rec_dtl[0]['rec_amount'] = $this->_aParam['amount'];
                    $rec_dtl[0]['primary_recvr'] = "false";}else{
                    if(count($pay_ids) >0){
                        $j = 0;
                        foreach($pay_ids as $pay){
                            if($pay[$j] != 'NULL'){
                                $rec_dtl[$j]['rec_email'] = $pay;
                                $rec_dtl[$j]['primary_recvr'] = 'false';                        }
                            $j++;
                        }      
                    }
                    switch (count($pay_ids)) {
                        case 1:
                            $rec_dtl[0]['rec_amount'] = $this->_aParam['amount'];
                            break;
                        case 2:
                            if($pay_ids[1] == 'NULL'){
                                $rec_dtl[0]['rec_amount'] = $this->_aParam['amount'];
                            }else{
                                $rec_dtl[0]['rec_amount'] = $this->_aParam['amount']-1;
                                $rec_dtl[1]['rec_amount'] = '1.00';
                            }
                            break;
                        case 3:
                            if($pay_ids[1]=='NULL' && $pay_ids[2]=='NULL'){
                                $rec_dtl[0]['rec_amount'] = $this->_aParam['amount'];
                            }
                            if($pay_ids[2] == 'NULL'){
                                $rec_dtl[0]['rec_amount'] = $this->_aParam['amount']-1;
                                $rec_dtl[1]['rec_amount'] = '1.00';
                            }
                            if($pay_ids[1] == 'NULL'){
                                $rec_dtl[0]['rec_amount'] = $this->_aParam['amount'];
                            }else{
                                $rec_dtl[0]['rec_amount'] = $this->_aParam['amount']-2;
                                $rec_dtl[1]['rec_amount'] = '1.00';
                                $rec_dtl[2]['rec_amount'] = '1.00';
                            }
                            break;

                        default:
                            break;
                    }
                }
                $receiver = array();
                $recvr_dtls = $rec_dtl;
                $currencyCode = $this->_aParam['currency_code'];
                $returnUrl = $cancelUrl = $this->_aParam['return'];
                for($i=0; $i<count($recvr_dtls); $i++) {
                    $receiver[$i] = new Receiver();
                    $receiver[$i]->email = $recvr_dtls[$i]['rec_email'];
                    $receiver[$i]->amount = $recvr_dtls[$i]['rec_amount'];
                    $receiver[$i]->primary = $recvr_dtls[$i]['primary_recvr'];
                }
                $receiverList = new ReceiverList($receiver);
                $payRequest = new PayRequest(new RequestEnvelope("en_US"), "PAY", $cancelUrl, $currencyCode, $receiverList, $returnUrl);$payRequest->returnUrl = $returnUrl;
                $payRequest->currencyCode = $currencyCode;
                $payRequest->receiverList = $receiverList;
                $service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
                $response = $service->Pay($payRequest);

                $ack = strtoupper($response->responseEnvelope->ack);

                if($ack == "SUCCESS"){$payKey = $response->payKey;
                    $aForm = array(
                        'url' => ($this->_aParam['is_test'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr&cmd=_ap-payment&paykey='.$payKey : 'https://www.paypal.com/cgi-bin/webscr&cmd=_ap-payment&paykey=' . $payKey),
                        'item_name' => $this->_aParam['item_name'],
                        'item_number' => $this->_aParam['item_number'],
                        'currency_code' => $this->_aParam['currency_code'],
                        'amount' => $this->_aParam['amount'],
                        'notify_url' => Phpfox::getLib('gateway')->url('paypal'),
                        'return' => $this->_aParam['return'],'rm'=> '2',
                        'no_shipping' => '1',
                        'no_note' => '1'
                    );
                }else{$aForm = array('url' => '#');
                    return Phpfox_Error::display('Failed Registration!!');
                }}else{$aForm = array(
        'url' => ($this->_aParam['is_test'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr'),
        'param' => array(
            'business' => $this->_aParam['setting']['paypal_email'],
            'item_name' => $this->_aParam['item_name'],
            'item_number' => $this->_aParam['item_number'],
            'currency_code' => $this->_aParam['currency_code'],
            'notify_url' => Phpfox::getLib('gateway')->url('paypal'),
            'return' => $this->_aParam['return'],
            'no_shipping' => '1',
            'no_note' => '1'
        )
    );if ($this->_aParam['recurring'] > 0)
    {
        switch ($this->_aParam['recurring'])
        {
            case '1':
                $t3 = 'M'; 
                $p3 = 1;
                break;
            case '2':
                $t3 = 'M'; 
                $p3 = 3;
                break;
            case '3':
                $t3 = 'M'; 
                $p3 = 6;
                break;
            case '4':
                $t3 = 'Y'; 
                $p3 = 1;
                break;              
        }           

        if (!empty($this->_aParam['alternative_recurring_cost']))
        {
            $aCosts = unserialize($this->_aParam['alternative_recurring_cost']);
            $bPassed = false;
            foreach ($aCosts as $sKey => $iCost)
            {
                if (in_array($sKey, $this->_aCurrency))
                {
                    $this->_aParam['recurring_cost'] = $iCost;
                    if (is_array($this->_aParam['recurring_cost']))
                    {
                        $aRec = array_values($this->_aParam['recurring_cost']);
                        $this->_aParam['recurring_cost'] = array_shift($aRec);
                    }
                    $bPassed = true;
                    break;
                }
            }

            if ($bPassed === false)
            {
                return false;
            }
        }

        /* 
            a1 is optional an price for the trial period @see https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables#id08A6HI00JQU 
            a3 is the price of the transaction required
        */

                    $aForm['param']['cmd'] = '_xclick-subscriptions';
                    $aForm['param']['a1'] = $this->_aParam['amount'];
                    $aForm['param']['a3'] = $this->_aParam['recurring_cost']; // $aCosts[$this->_aParam['currency_code']]; change made for 3.7.1
                    $aForm['param']['t1'] = $t3;
                    $aForm['param']['p1'] = $p3;
                    $aForm['param']['t3'] = $t3;
                    $aForm['param']['p3'] = $p3;            
                    $aForm['param']['src'] = '1';
                    $aForm['param']['sra'] = '1';
    }
    else 
    {
                    $aForm['param']['cmd'] = '_xclick';
                    $aForm['param']['amount'] = $this->_aParam['amount'];       
    }
        }

    return $aForm;
}
公共函数getForm()
{       
$bCurrencySupported=true;
echo“console.log('in-paypal')”;
if(!in_数组($this->_aParam['currency\u code'],$this->_aCurrency))
{
如果(!empty($this->_aParam['alternative_cost']))
{
$aCosts=非序列化($this->_aParam['alternative_cost');
foreach($aCost作为$aCost)
{
$sCode=键($aCost);
$iPrice=$aCost[关键($aCost)];
if(在数组中($sCode,$this->\u aCurrency))
{
$this->_aParam['amount']=$iPrice;
$this->_aParam['currency\u code']=$sCode;
$bCurrencySupported=false;
打破
}
}
如果($bCurrencySupported==true)
{
返回false;
}
}
其他的
{
返回false;
}
}#//儿子
$package_id=$this->_aParam['package_id'];//购买的package id-2:好朋友
echo“console.log('packageId-in-paypalclass-$package_id');
如果($package_id==2){
#//如果是升级,请点击chk
$isUpgrad=$this->_aParam['is_upgrad'];
如果(isset($isUpgrad)&&$isUpgrad==1){
返回Phpfox_错误::display('需要邀请升级到此订阅级别!!');
}
#//获取邀请者用户的详细信息*/
$pay_id=$this->_aParam['pay_id'];
echo“console.log('payid-count-“.count($pay_-id)。”)”;
#//回显“”;打印($pay\u id);回显“”;
如果($pay_id[0]=='admin'){
$rec_dtl[0]['rec_email']=$this->\u aParam['setting']['paypal_email'];
$rec_dtl[0]['rec_amount']=$this->\u aParam['amount'];
$rec_dtl[0]['primary_recvr']=“false”;}其他{
如果(计数($pay_id)>0){
$j=0;
foreach($pay_id as$pay){
如果($pay[$j]!='NULL'){
$rec_dtl[$j]['rec_email']=$pay;
$rec_dtl[$j]['primary_recvr']='false';}
$j++;
}      
}
开关(计数($pay_ID)){
案例1:
$rec_dtl[0]['rec_amount']=$this->\u aParam['amount'];
打破
案例2:
如果($pay_id[1]=='NULL'){
$rec_dtl[0]['rec_amount']=$this->\u aParam['amount'];
}否则{
$rec_dtl[0]['rec_amount']=$this->\u aParam['amount']-1;
$rec_dtl[1]['rec_amount']='1.00';
}
打破
案例3:
如果($pay\u id[1]='NULL'&&$pay\u id[2]='NULL'){
$rec_dtl[0]['rec_amount']=$this->\u aParam['amount'];
}
如果($pay_id[2]=='NULL'){
$rec_dtl[0]['rec_amount']=$this->\u aParam['amount']-1;
$rec_dtl[1]['rec_amount']='1.00';
}
如果($pay_id[1]=='NULL'){
$rec_dtl[0]['rec_amount']=$this->\u aParam['amount'];
}否则{
$rec_dtl[0]['rec_amount']=$this->\u aParam['amount']-2;
$rec_dtl[1]['rec_amount']='1.00';
$rec_dtl[2]['rec_amount']='1.00';
}
打破
违约:
打破
}
}
$receiver=array();
$recvr\U dtl=$rec\U dtl;
$currencyCode=$this->_aParam['currency_code'];
$returnUrl=$cancelUrl=$this->_aParam['return'];
对于($i=0;$iemail=$recvr_dtls[$i]['rec_email'];
$receiver[$i]->amount=$recvr_dtls[$i]['rec_amount'];
$receiver[$i]->primary=$recvr\u dtls[$i]['primary\u recvr'];
}
$receiverList=新的receiverList($receiver);
$payRequest=new payRequest(新请求信封(“en_US”),“PAY”,$cancelUrl,$currencyCode,$receiverList,$returnUrl);$payRequest->returnUrl=$returnUrl;
$payRequest->currencyCode=$currencyCode;
$payRequest->receiverList=$receiverList;
$service=new AdaptivePaymentsService(配置::getAcctAndConfig());
$response=$service->Pay($payRequest);
$ack=strtoupper($response->responseenevelope->ack);
如果($ack==“SUCCESS”){$payKey=$response->payKey;
$aForm=数组(
'url'=>($this->_aParam['is_test']?'https://www.sandbox.paypal.com/cgi-bin/webscr&cmd=_ap-payment&paykey='。$paykey:'https://www.paypal.com/cgi-bin/webscr&cmd=_ap-付款和支付钥匙='。$paykey),
'item_name'=>this->\u aParam['item_name'],
“项目编号”=>this->\u aParam[“项目编号”