PayPal付款高级+ PayFlow链接

时间:2012-04-24 22:14:19

标签: paypal

尝试通过PayFlow Gateway提交沙盒付款时,我一直收到以下错误:

  

错误:处理您的请求时出现问题。请按下   浏览器的后退按钮,然后刷新页面。如果你继续   如有问题,请与我们联系。

我正在使用以下代码生成我的PayFlow网关,但我无法让它工作。

/* PayPal Payments Advanced */

$PF_USER        = 'my_user';
$PF_VENDOR  = 'my_vendor';
$PF_PARTNER     = 'PayPal';
$PF_PWD     = 'my_pass';
$PF_MODE        = 'TEST';
$PF_HOST_ADDR   = 'https://pilot-payflowpro.paypal.com'; // TEST mode
// $PF_HOST_ADDR = 'https://payflowpro.paypal.com' // LIVE mode

$secureTokenId  = uniqid('',true);
$postData       = "USER=".$PF_USER
                ."&VENDOR=".$PF_VENDOR
                ."&PARTNER=".$PF_PARTNER
                ."&PWD=".$PF_PWD

                ."&SECURETOKENID=".$secureTokenId
                ."&CREATESECURETOKEN=Y"
                ."&TRXTYPE=S"
                ."&AMT=1.00"

                ."&BILLTOFIRSTNAME=".$first_name
                ."&BILLTOLASTNAME=".$last_name
                ."&BILLTOSTREET=".$address
                ."&BILLTOCITY=".$city
                ."&BILLTOSTATE=".$state
                ."&BILLTOZIP=".$zip
                ."&BILLTOCOUNTRY=".$country

                ."&SHIPTOFIRSTNAME=".$first_name
                ."&SHIPTOLASTNAME=".$last_name
                ."&SHIPTOSTREET=".$address
                ."&SHIPTOCITY=".$city
                ."&SHIPTOSTATE=".$state
                ."&SHIPTOZIP=".$zip
                ."&SHIPTTOCOUNTRY=".$country

                ."&EMAIL=".$email
                ."&PHONENUM=".$phone;

/* Initialize and Setup Request */

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$PF_HOST_ADDR);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POST,true);

/* Ready the postData to send */

curl_setopt($ch,CURLOPT_POSTFIELDS,$postData);

/* Send the data to PayPal and assign response */

$resp = curl_exec($ch);

/* Confirm response and handle */

if(!$resp){
    $error = '<p>There was an error processing your order.</p>';    
}

/* Parse and assign to array */

parse_str($resp,$arr);

if($arr['RESULT'] != 0) {
    // handle error
    die($arr['RESULT']);
    $error = '<p>There was an error processing your order. '.$arr['RESULT'].'</p>';
}

echo '<iframe src="https://payflowlink.paypal.com?mode='.$PF_MODE.'&amp;SECURETOKEN='.$arr['SECURETOKEN'].'&amp;SECURETOKENID='.$secureTokenId.'" width="550" height="565" scrolling="no" frameborder="0" border="0" allowtransparency="true"></iframe>';

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

我必须明确将我的Firefox隐私设置设置为“允许”第三方Cookie。这样做会使错误消息消失。我在Safari上没有这个问题。