【发布时间】:2015-09-23 19:32:51
【问题描述】:
Paypal Payment Pro 新手,不使用现成的购物车。我已经设置了我的帐户,并想使用 PayPal 的托管结帐页面之一。出于测试目的,我刚刚生成了一个“立即购买”按钮,费用为 1.00 美元,可将我带到 Paypal 结帐页面。但是,当尝试处理付款时,我在错误日志中收到以下信息,这是我发送返回数组的位置:
[06-Jul-2015 11:22:57 America/Halifax] Array
(
[TYPE] => S
[RESPMSG] => Invalid merchant information: 10002-You do not have permissions to make this API call
[ACCT] => 1111
[COUNTRY] => CA
[TAX] => 0.00
[CARDTYPE] => 0
[LASTNAME] => NotProvided
[PNREF] => B70P7DC0A255
[TENDER] => CC
[AVSDATA] => XXN
[METHOD] => CC
[SECURETOKEN] => 9f50xjlryKE2myw4aDnjM3wsJ
[SHIPTOCOUNTRY] => CA
[AMT] => 1.00
[SECURETOKENID] => 559a8f2cdb4034.19928099
[TRANSTIME] => 2015-07-06 07:22:55
[HOSTCODE] => 10002
[COUNTRYTOSHIP] => CA
[RESULT] => 5
[BILLTOCOUNTRY] => CA
[EXPDATE] => 0620
[TRXTYPE] => S
)
这是无效商家信息的RESPMSG:10002-您无权进行此API调用,这让我很沮丧。我不明白为什么它不起作用。到目前为止,我一直从 PayPal 那里得到帮助,但还没有能够与任何知道如何提供帮助的人交谈。
这是我的代码...
function makeBuyButton($amt, $txt = "Buy Now!")
{
$PF_USER = "apiusername";
$PF_VENDOR = "merchantname";
$PF_PARTNER = "paypalca";
$PF_PWD = "xxxxxxxx"; // <--modified for forum
$PF_MODE = "TEST";
$PF_HOST_ADDR = "https://pilot-payflowpro.paypal.com";
// $PF_HOST_ADDR = "https://payflowpro.paypal.com;
$secureTokenID = uniqid('', true);
$postData = "USER=" . $PF_USER
. "&VENDOR=" . $PF_VENDOR
. "&PARTNER=" . $PF_PARTNER
. "&PWD=" . $PF_PWD
. "&CREATESECURETOKEN=Y"
. "&SECURETOKENID=" . $secureTokenID
. "&TRXTYPE=S"
. "&AMT=" . $amt;
//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 the response
$resp = curl_exec($ch);
//Confirm that a response was received and handle the error
if(!$resp)
{
return "<p>To order, please contact us</p>";
}
//Parse and assign to array
parse_str($resp, $arr);
if($arr['RESULT'] != 0)
{
return "<p>To order, please contact us</p>";
}
return "<form method='post' action='https://pilot-payflowlink.paypal.com/'>
<input type='hidden' name='SECURETOKEN' value='" . $arr['SECURETOKEN'] . "' />
<input type='hidden' name='SECURETOKENID' value='" . $secureTokenID . "' />
<input type='hidden' name='MODE' value='" . $PF_MODE . "' />
<input type='submit' value='" . $txt . "' />
</form>";
}
我用
调用函数<?=makeBuyButton(1.00); ?>
按钮有效,我进入结帐页面,但不幸的是它没有处理并给出上面的 10002 错误。
感谢您提供的任何帮助。
【问题讨论】: