错误代码:520003当测试隐含付款以便将钱发送到实时贝宝的其他paypal帐户?
我的paypal应用程序状态:有条件批准
当我测试时,它会显示这样的错误。
............................................... .................................................. .................................................. .................
Warning: Missing argument 3 for AdaptiveCall(), called in /home1/mkjhjjjj/public_html/note.php on line 91 and defined in /home1/mkjhjjjj/public_html/note.php on line 3
ERROR Code: 520003
ERROR Message: Authentication failed. API credentials are incorrect.
这是我的代码。
............................................... .................................................. .................................................. .................
<?php
function AdaptiveCall($bodyparams, $method, $payKey) {
try
{
$body_data = http_build_query($bodyparams, "", chr(38));
$url = trim("https://svcs.sandbox.paypal.com/AdaptivePayments/".$method."");
$params = array("http" => array(
"method" => "POST",
"content" => $body_data,
"header" => "X-PAYPAL-SECURITY-USERID: payments_api1.mysite.com\r\n" .
"X-PAYPAL-SECURITY-SIGNATURE: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n" .
"X-PAYPAL-SECURITY-PASSWORD: xxxxxxxxxxxxxx\r\n" .
"X-PAYPAL-APPLICATION-ID: APP-xxxxxxxxxxxxxxx\r\n" .
"X-PAYPAL-REQUEST-DATA-FORMAT: NV\r\n" .
"X-PAYPAL-RESPONSE-DATA-FORMAT: NV\r\n"
)
);
//create stream context
$ctx = stream_context_create($params);
//open the stream and send request
$fp = @fopen($url, "r", false, $ctx);
//get response
$response = stream_get_contents($fp);
//check to see if stream is open
if ($response === false) {
throw new Exception("php error message = " . "$php_errormsg");
}
//close the stream
fclose($fp);
//parse the ap key from the response
$keyArray = explode("&", $response);
foreach ($keyArray as $rVal){
list($qKey, $qVal) = explode ("=", $rVal);
$kArray[$qKey] = $qVal;
}
//print the response to screen for testing purposes
If ( $kArray["responseEnvelope.ack"] == "Success") {
echo "<strong>".$method ."</strong><br>";
foreach ($kArray as $key =>$value){
echo $key . ": " .$value . "<br/>";
}
// Return payKey
global $payKey;
if(!empty($kArray['payKey'])) { $payKey = $kArray['payKey']; return($payKey); }
}
else {
echo 'ERROR Code: ' . $kArray["error(0).errorId"] . " <br/>";
echo 'ERROR Message: ' . urldecode($kArray["error(0).message"]) . " <br/>";
}
}
catch(Exception $e) {
echo "Message: ||" .$e->getMessage()."||";
}
}
//Create Pay body
$bodyparams = array ( "requestEnvelope.errorLanguage" => "en_US",
'actionType' => 'PAY',
'currencyCode' => 'USD',
'receiverList.receiver(0).email' => 'xxxxxx@hotmail.com',
'receiverList.receiver(0).amount' => '1.00',
'senderEmail' => 'xxxxxxxxx',
'memo' => 'Test memo',
'ipnNotificationUrl' => 'http://www.xxxxxx.com/index.php',
'cancelUrl' => 'http://www.xxxxxx.com/index.php',
'returnUrl' => 'http://www.xxxxxx.com/index.php'
);
// Call Pay API
AdaptiveCall($bodyparams, "Pay");
?>
答案 0 :(得分:0)
如果您正在使用Live环境确保更新端点,请从您的代码中看到您指向Sandbox“https://svcs.sandbox.paypal.com/AdaptivePayments/”,这可能就是您获得的原因错误的凭据错误。
确保使用具有针对该特定环境的正确API凭据的正确端点。有关更多信息,请访问 上线检查表页面&gt; link
如果您尚未执行此操作,为了获得真实帐户的“隐含付款”权限,您需要在https://developer.paypal.com处申请您的APP ID(经典) &GT;应用程序&gt;我的应用&gt;创建和管理Classic API应用程序。 务必从基本付款选项中选择“隐式汇款”。