2013-06-10 2 views
0

나는 PAYPAL를 사용하여 Expresscheckout API를 만들고있다. expresscheckout을 설정하고 expresscheckout이 제대로 작동하는지 확인하십시오. 나는이 두 단계에서 tocken과 payerid를 얻는다. 하지만 DoExpresscheckout으로 이동하면 ACK 오류가 발생합니다.DoExpress 체크 아웃이 작동하지 않습니다. 그것은 ACK 실패를 준다

DoExpressCheckoutPaymentResponseType Object 
(
    [DoExpressCheckoutPaymentResponseDetails] => 
    [FMFDetails] => 
    [Timestamp] => 2013-06-10T12:15:02Z 
    [Ack] => Failure 
    [CorrelationID] => a88b9b744676a 
    [Errors] => Array 
     (
      [0] => ErrorType Object 
       (
        [ShortMessage] => This Express Checkout session has expired. 
        [LongMessage] => This Express Checkout session has expired. Token value is no longer valid. 
        [ErrorCode] => 10411 
        [SeverityCode] => Error 
        [ErrorParameters] => 
       ) 

     ) 

    [Version] => 98.0 
    [Build] => 6341744 
) 

은 하나가 DoExpresscheckout에 대한 올바른 코드를 가지고 있으며 사점 만들기 위해 어떤 분야를 필요로하는합니까?

+0

doexpresscheckout에 토큰/지불기 ID를 추가합니까? –

답변

1

잘 페이팔 SDK는 매우 간단합니다. 먼저 내가 당신의 예제 코드를 설치하고 서버에서 제대로 작동하는지 확인해 보았습니다. 이전 경험에서 SDK가 작동하지 않고 PHP 버전 문제가있는 드문 경우가 있습니다. 당신이 당신의 서버에서 작동 확신 둘째 후

차트 흐름은 다음과 같습니다

1 단계) SetExpressCheckout - 같은 모든 필수 필드 : 청구 주소, 제품은 총 등 ...

그 카트

이이 토큰을 얻을 것이다 올바른 수행 된 경우,

2 단계) GetExpressCheckout - 이전에 취득으로는 당신이 당신이 얻을 것이다 올바른하는 경우에 GetExpressCheckout이 토큰을 통과 할 것 토큰 : 승인, 토큰 , PayerID, value, currencyID 및 기본적으로 모든 구매 세부 사항이있는 오브젝트입니다.

3 단계) DoExpressCheckout - 다음과 같이 DoExpressCheckout을 2에서 획득 한 필드를 사용 :

$path = $pluginfolder.'paypal/lib'; 
set_include_path(get_include_path() . PATH_SEPARATOR . $path); 
require_once('services/PayPalAPIInterfaceService/PayPalAPIInterfaceServiceService.php'); 
require_once('PPLoggingManager.php'); 

$logger = new PPLoggingManager('DoExpressCheckout'); 

$token = urlencode($getToken); 
$payerId = urlencode( $getPayerID); 
$paymentAction = urlencode( $paymentType); 

$orderTotal = new BasicAmountType(); 
$orderTotal->currencyID = $getCurrencyID; 
$orderTotal->value = $getOrderTotal; 

$paymentDetails= new PaymentDetailsType(); 
$paymentDetails->OrderTotal = $orderTotal; 
if(isset($notifyURL)) 
{ 
    $paymentDetails->NotifyURL = $notifyURL; 
} 

$DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType(); 
$DoECRequestDetails->PayerID = $payerId; 
$DoECRequestDetails->Token = $token; 
$DoECRequestDetails->PaymentAction = $paymentAction; 
$DoECRequestDetails->PaymentDetails[0] = $paymentDetails; 

$DoECRequest = new DoExpressCheckoutPaymentRequestType(); 
$DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails; 


$DoECReq = new DoExpressCheckoutPaymentReq(); 
$DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest; 

/* 
* Trying to go a head with the payment and catching errors that might occure. 
*/ 
try { 
    /* wrap API method calls on the service object with a try catch */ 
    $DoECResponse = $paypalService->DoExpressCheckoutPayment($DoECReq); 
} catch (Exception $ex) { 
    if(isset($ex)) { 
     $ex_message = $ex->getMessage(); 
     $ex_type = get_class($ex); 

     if($ex instanceof PPConnectionException) { 
      $error[] = "Error connecting to " . $ex->getUrl(); 
      $errorCheck = true; 
     } else if($ex instanceof PPMissingCredentialException || $ex instanceof PPInvalidCredentialException) { 
      $error[] = $ex->errorMessage(); 
      $errorCheck = true; 
     } else if($ex instanceof PPConfigurationException) { 
      $error[] = "Invalid configuration. Please check your configuration file"; 
      $errorCheck = true; 
     } 
    } 
} 

난이 도움이되기를 바랍니다.

관련 문제