API Paypal – GetVerifiedStatus – Недействительный запрос

Я пытаюсь интегрировать API Paypal в моем приложении PHP. Я использую cURL для вызова удаленного метода GetVerifiedStatus , но я получаю сообщение об ошибке 580023 – Invalid Request.

Мой запрос:

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

Ответ после преобразования в 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, eg, 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; } 

Config:

 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?

Я столкнулся с этой же проблемой и связался с технической поддержкой PayPal, и решение было просто в том, что ошибка 580023 – это обычное поведение, когда имя не соответствует электронной почте учетной записи PayPal. Это сбивает с толку, потому что нет ничего плохого в запросе, вопреки тому, что подразумевает ответное сообщение. Итак, для вашего примера, если у вас есть одна и та же проблема, вам просто нужно изменить Джону Доу на имя и фамилию пользователя, связанные с электронной почтой, с которой вы пытаетесь сопоставить.

Стенограмма моего конвоя с PayPal MTS:

«Ожидается, что вы получите ошибку. Чтобы получить ответ подтвержденного или непроверенного, указанное вами имя должно соответствовать указанному вами адресу электронной почты».

Попробуй это

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); instead of curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

Paypal Docs

 580023 Invalid Request. 

Код ошибки говорит, что это недопустимый запрос, так что это то, что вы отправляете, это проблема, можете ли вы предоставить свой фактический запрос?