douling6469 2013-06-10 12:17
浏览 20
已采纳

快速结账无法正常工作。 它给出了ACK失败

i am creating Expresscheckout API using PAYPAL. Set expresscheckout and get expresscheckout is working properly. i get a tocken and payerid from these two steps. but when i goto DoExpresscheckout it gives me ACK failure.

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
)

Does any one have correct code for DoExpresscheckout and what fields are require for make it Sucessful ??

  • 写回答

1条回答 默认 最新

  • duanliao5995 2013-06-10 12:43
    关注

    well paypal SDK is extremely simple. first if i were you i would install their example code and make sure it work on your server, from my previous experience there are rare cases where the SDK wont work and have php version issues.

    Secondly after you're sure it works on your server, the chart flow is:

    step 1.) SetExpressCheckout - with all the required fields like:billing address, products cart total etc...

    if that was done correct you'll get a token,

    step 2.) GetExpressCheckout - With the previously acquired token you'll do GetExpressCheckout passing the token, if that done correct you'll get:Ack, Token, PayerID, value, currencyID and basically an object that has all the purchase details.

    step 3.) DoExpressCheckout - use the acquired fields from 2 to do a DoExpressCheckout as follows:

    $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;
            }
        }
    }
    

    i hope that helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab