2013-08-13 6 views
2

페이팔 IPN 콜백에 문제가 있습니다. 샌드 박스 환경에서 Paypal의 IPN 콜백이 작동을 멈췄습니다.샌드 박스 환경에서 PayPal IPN 콜백이 작동하지 않습니다.

나는 지난 주 동안 내 고객의 웹 사이트를 테스트 해왔고 항상 올바르게 작동했습니다. - 지불이 이루어졌으며 콜백 IPN이 웹 사이트로 돌아가 지불을 확인하고 웹 사이트를 업데이트했습니다. 데이터 베이스.

내 코드에서 아무 것도 변경하지 않고 갑자기 작동을 멈췄습니다. 지불은 여전히 ​​이루어지고 페이팔 계정에 저장되지만 IPN은 항상 다시 시도 중입니다 ... 완료되지 않습니다. 나는 그것이 이미했습니다

if(!($res = curl_exec($ch))) { 

하기 전에 첫 번째 단계를 통과하고 두 번째에 중지 사실을 발견,

<?php 

// STEP 1: read POST data 

// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST. 
// Instead, read raw POST data from the input stream. 
$raw_post_data = file_get_contents('php://input'); 
$raw_post_array = explode('&', $raw_post_data); 
$myPost = array(); 
foreach ($raw_post_array as $keyval) { 
$keyval = explode ('=', $keyval); 
if (count($keyval) == 2) 
$myPost[$keyval[0]] = urldecode($keyval[1]); 
} 
// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate' 
$req = 'cmd=_notify-validate'; 
if(function_exists('get_magic_quotes_gpc')) { 
$get_magic_quotes_exists = true; 
} 
foreach ($myPost as $key => $value) { 
if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { 
$value = urlencode(stripslashes($value)); 
} else { 
$value = urlencode($value); 
} 
$req .= "&$key=$value"; 
} 

// STEP 2: POST IPN data back to PayPal to validate 

$ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr'); 
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $req); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); 

// In wamp-like environments that do not come bundled with root authority certificates, 
// please download 'cacert.pem' from [link removed] and set 
// the directory path of the certificate as shown below: 
// curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem'); 
if(!($res = curl_exec($ch))) { 
// error_log("Got " . curl_error($ch) . " when processing IPN data"); 
curl_close($ch); 
exit; 
} 
curl_close($ch); 

…… 

?> 

텍스트 파일로 일부 출력을 발사 : 여기

사용의 코드입니다 3 개의 도움말 요청을 PayPal에 제출했지만 여전히 답변을받지 못했습니다.

+0

은 도움이 될 수 있습니다이 문서 https://developer.paypal.com/webapps/developer/docs/classic/ipn/gs_IPN/ –

+0

안녕하세요 덴마크어, 당신의 응답을 주셔서 감사를 참조하십시오. 나는 그 스크립트를 이미 테스트했습니다. 내가 시험해 본 것 중 하나 였어. 그런 다음 스크립트로 변경했습니다. https://developer.paypal.com/webapps/developer/docs/classic/ipn/ht_ipn/ 이 스크립트는 완벽하게 작동했지만 갑자기 작동이 멈췄습니다. Thanx –

+0

나는 테스트를 거쳤으며 Curl과 관련된 문제인 것처럼 보입니다.IPN이 방식으로 작동하도록되어 : 1 - 페이팔은 거래와 콜백을 전송하는 2 바르 - 그 바르 페이팔로 다시 전송되는 수신 파일에서 확인 3 - 페이팔은 수신 된 정보의 유효성을 검사 4 - 페이팔 "VERIFIED"또는 "INVALID"로 응답합니다. 콜백 파일에서받은 vars가 구문 분석되어 paypal로 올바르게 전송됩니다. URL을 복사하여 브라우저에 직접 제출하면 "VERIFIED"응답이 표시됩니다. 그러나 Curl을 통해 제출할 때 오류가 발생합니다 (호스트에 연결할 수 없음). 어떤 아이디어? Thanx –

답변

2

cURL 요청은 IPN 메시지의 유효성을 검사하기 위해 PayPal로 다시 HTTP POST를 시작합니다. 이 단계에서 중지하면 을 의미합니다.은 PayPal에서 IPN POST를 수신하지만 PayPal에 다시 연결하는 데 문제가 있습니다.

// error_log("Got " . curl_error($ch) . " when processing IPN data");에는 무엇이 있습니까?

예를 들어, 당신이 당신의 서버에서 직접 컬을 실행할 수 있습니다,이 문제를 해결하려면 다음 주소로 서버에서 HTTPS 연결을 테스트하기 위해

(SSH 액세스 권한이 있다고 가정).

curl -v https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate

이 다음과 유사한 반환해야합니다 : 당신은 시간 제한 또는 SSL 핸드 셰이크 오류가 발생하는 경우

$ curl -v https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate 
* About to connect() to www.sandbox.paypal.com port 443 (#0) 
* Trying 173.0.82.77... 
* connected 
* Connected to www.sandbox.paypal.com (173.0.82.77) port 443 (#0) 
* successfully set certificate verify locations: 
* CAfile: /usr/ssl/certs/ca-bundle.crt 
    CApath: none 
* SSLv3, TLS handshake, Client hello (1): 
* SSLv3, TLS handshake, Server hello (2): 
* SSLv3, TLS handshake, CERT (11): 
* SSLv3, TLS handshake, Server finished (14): 
* SSLv3, TLS handshake, Client key exchange (16): 
* SSLv3, TLS change cipher, Client hello (1): 
* SSLv3, TLS handshake, Finished (20): 
* SSLv3, TLS change cipher, Client hello (1): 
* SSLv3, TLS handshake, Finished (20): 
* SSL connection using AES256-SHA 
* Server certificate: 
*  subject: 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; businessCategory=Private Organization; serialNumber=3014267; C=US; postalCode=95131-2021; ST=California; L=San Jose; street=2211 N 1st St; O=PayPal, Inc.; OU=PayPal Production; CN=www.sandbox.paypal.com 
*  start date: 2011-09-01 00:00:00 GMT 
*  expire date: 2013-09-30 23:59:59 GMT 
*  common name: www.sandbox.paypal.com (matched) 
*  issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)06; CN=VeriSign Class 3 Extended Validation SSL CA 
*  SSL certificate verify ok. 
> GET /cgi-bin/webscr?cmd=_notify-validate HTTP/1.1 
> User-Agent: curl/7.28.1 
> Host: www.sandbox.paypal.com 
> Accept: */* 
> 
* HTTP 1.1 or later with persistent connection, pipelining supported 
< HTTP/1.1 200 OK 
< Date: Wed, 14 Aug 2013 20:15:53 GMT 
< Server: Apache 
< X-Frame-Options: SAMEORIGIN 
< Set-Cookie: xxxxx  
< X-Cnection: close 
< Set-Cookie: xxxx domain=.paypal.com; path=/; Secure; HttpOnly 
< Set-Cookie: Apache=10.72.128.11.1376511353229960; path=/; expires=Fri, 07-Aug-43 20:15:53 GMT 
< Vary: Accept-Encoding 
< Strict-Transport-Security: max-age=14400 
< Transfer-Encoding: chunked 
< Content-Type: text/html; charset=UTF-8 
< 
* Connection #0 to host www.sandbox.paypal.com left intact 
**INVALID* Closing connection #0** 
* SSLv3, TLS alert, Client hello (1): 

을 별도로이 문제를 조사해야합니다.

+0

안녕하세요 로버트, 고맙습니다. 다시 작동합니다. 어제 (LIVE) 지불 한 금액은 보류 중이지만, 오늘은 이미 확인한 곳입니다. 나는 2 개를 더 테스트했고, 그들은 자동으로 IPN을 확인했다. 이상한 것들에 대한 설명이 있습니까 : - 7 월 26 일 - IPN이 작동을 멈 춥니 다. - 8 월 14 일 - IPN이 다시 작동합니다 - 샌드 박스. - 8 월 14 일 - IPN이 작동을 멈 춥니 다 - 라이브 모드 (406 오류). - 8 월 15 일 - IPN이 다시 작동합니다 - 라이브 모드. 내 부분이 변경되지 않았습니다. 다음은 paypal에 제출 된 모든 티켓입니다 : # 130810-000033, # 130804-000067, # 130731-000377, # 130726-000079. 고관 –

+0

내 측면에서 보면, 내가 볼 수있는 것은 아무것도 설명하지 못할 것입니다. 며칠 동안 IPN 유효성 검사 끝점에 연결할 수 없었지만 IP 주소를 블랙리스트에 올리지는 못하는 이유가 무엇일까? – Robert

+0

고맙습니다. 나는 결코 알 수 없을 것 같아요. 그러나 중요한 것은 그것이 지금 ok 일하고 있다는 것입니다 :) 다시 도움을 주셔서 감사합니다. –

관련 문제