Paypal API-GetVerifiedStatus-无效的请求 [英] Paypal API - GetVerifiedStatus - Invalid request

查看:120
本文介绍了Paypal API-GetVerifiedStatus-无效的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Paypal API集成到我的PHP应用程序中.我使用cURL调用远程方法 GetVerifiedStatus ,但出现错误580023-无效请求.

I'm trying to integrate Paypal API in my PHP application. I use cURL to call remote method GetVerifiedStatus, but I'm getting an error 580023 - Invalid Request.

我的请求:

 'requestEnvelope.errorLanguage=en_US&requestEnvelope.detailLevel=ReturnAll&emailAddress=email%40address.com&firstName=John&lastName=Doe&matchCriteria=NAME'

转换为JSON后的响应:

Response after converting to JSON:

{
        "responseEnvelope.timestamp":"2013-07-25T05:36:26.695-07:00",
        "responseEnvelope.ack":"Failure",
        "responseEnvelope.correlationId":"e540c8c04a5b4",
        "responseEnvelope.build":"6679946",
        "error(0).errorId":"580023",
        "error(0).domain":"PLATFORM",
        "error(0).subdomain":"Application",
        "error(0).severity":"Error",
        "error(0).category":"Application",
        "error(0).message":"Cannot determine PayPal Account status"

}

cURL代码

function hash_call_account($methodName, $nvpStr)
    {
        //declaring of global variables

        $this->API_Endpoint_Adaptive_Account .= "/" . $methodName;

        //setting the curl parameters.
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$this->API_Endpoint_Adaptive_Account);
        curl_setopt($ch, CURLOPT_VERBOSE, 1);

        //turning off the server and peer verification(TrustManager Concept).
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch, CURLOPT_POST, 1);

        // Set the HTTP Headers
        curl_setopt($ch, CURLOPT_HTTPHEADER,  array(
            'X-PAYPAL-REQUEST-DATA-FORMAT: NV',
            'X-PAYPAL-RESPONSE-DATA-FORMAT: NV',
            'X-PAYPAL-SECURITY-USERID: ' . $this->API_UserName,
            'X-PAYPAL-SECURITY-PASSWORD: ' .$this->API_Password,
            'X-PAYPAL-SECURITY-SIGNATURE: ' . $this->API_Signature,
            'X-PAYPAL-APPLICATION-ID: ' . $this->API_AppID
        ));

        //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
        //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php 
        if($this->USE_PROXY)
            curl_setopt ($ch, CURLOPT_PROXY, $this->PROXY_HOST. ":" . $this->PROXY_PORT); 

        // RequestEnvelope fields
        $detailLevel    = urlencode("ReturnAll");   // See DetailLevelCode in the WSDL for valid enumerations
        $errorLanguage  = urlencode("en_US");       // This should be the standard RFC 3066 language identification tag, e.g., en_US

        // NVPRequest for submitting to server
        $nvpreq = "requestEnvelope.errorLanguage=$errorLanguage&requestEnvelope.detailLevel=$detailLevel";
        $nvpreq .= "&$nvpStr";
        //echo $nvpreq; die;
        //setting the nvpreq as POST FIELD to curl
        curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

        //getting response from server
        $response = curl_exec($ch);

        //converting NVPResponse to an Associative Array
        $nvpResArray=$this->deformatNVP($response);
        $nvpReqArray=$this->deformatNVP($nvpreq);
        $_SESSION['nvpReqArray']=$nvpReqArray;

        if (curl_errno($ch)) 
        {
            // moving to display page to display curl errors
              $_SESSION['curl_error_no']=curl_errno($ch) ;
              $_SESSION['curl_error_msg']=curl_error($ch);

              //Execute the Error handling module to display errors. 
        } 
        else 
        {
             //closing the curl
            curl_close($ch);
        }

        return $nvpResArray;
    }

配置:

Configure::write('ParallelPayPalAPI.URL', 'https://svcs.sandbox.paypal.com/AdaptivePayments');
Configure::write('ParallelPayPalAPI.AdaptiveAccountURL', 'https://svcs.sandbox.paypal.com/AdaptiveAccounts');
Configure::write('ParallelPayPalAPI.api_username', user);
Configure::write('ParallelPayPalAPI.api_password', password);
Configure::write('ParallelPayPalAPI.api_signature', signature);
Configure::write('ParallelPayPalAPI.business', business);
Configure::write('ParallelPayPalAPI.PaymentDetailUrl', 'https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails');
Configure::write('ParallelPayPalAPI.AppID', AppId);

API版本可能有问题吗? NVP请求有任何问题吗?

Could be problem with version of API? Is there any problem with NVP request?

推荐答案

我遇到了同样的问题,并联系了贝宝技术支持,解决方案是,当名称与电子邮件地址的电子邮件地址不匹配时,错误580023是正常行为.贝宝帐户.这是令人困惑的,因为与响应消息所暗示的相反,请求完全没有错.因此,以您的示例为例,如果遇到相同的问题,则只需将John Doe更改为与您要匹配的贝宝电子邮件相关联的用户的名字和姓氏.

I ran into this same problem and contacted paypal technical support and the solution was simply that error 580023 is the normal behavior when the name fails to match the email of the paypal account. This is confusing because there is nothing wrong at all with the request, contrary to what the response message implies. So for your example, if you are having the same issue then you just need to change John Doe to the first name and last name of the user associated with the paypal email you are trying to match against.

我与Paypal MTS达成的谈话记录:

Transcript from my convo with paypal MTS:

您会收到错误消息.为了得到已验证或未验证的响应,您提供的名称必须与您提供的电子邮件地址匹配."

"The error you are receiving is expected. In order to get a response of verified or unverified, the name you provide must match the email address you provide."

这篇关于Paypal API-GetVerifiedStatus-无效的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆