Php 错误代码:520003在live paypal中测试隐式支付时?

Php 错误代码:520003在live paypal中测试隐式支付时?,php,paypal,paypal-adaptive-payments,Php,Paypal,Paypal Adaptive Payments,错误代码:520003在live paypal中测试向其他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

错误代码:520003在live paypal中测试向其他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");

?>
这是我的密码

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");

?>

如果您使用的是实时环境,请确保更新端点,从您的代码中,我可以看到您指向沙盒“”,这可能就是您收到错误凭据的原因

确保针对特定环境使用了具有正确API凭据的正确端点。有关更多信息,请访问 上线清单第页>

如果您还没有这样做,为了获得Live帐户的“隐式支付”权限,您需要在>应用程序>我的应用程序>创建和管理经典API应用程序中请求您的应用程序id(经典)。 确保从基本付款选项中选择“隐式汇款”