PaymentActionNotInitiated 何时进行 Express Checkout

Posted

技术标签:

【中文标题】PaymentActionNotInitiated 何时进行 Express Checkout【英文标题】:PaymentActionNotInitiated when do Express Checkout 【发布时间】:2014-03-04 06:16:41 【问题描述】:

我使用 Sandbox 将 Express Checkout 放入我的网站。一切正常:用户点击支付按钮,重定向到贝宝,使用沙盒买家的凭据登录到他的沙盒页面,点击继续按钮,最后重定向回我的网站,只需点击确认按钮。但是 Sandbox Seller 和 Byer 测试账户的资金支持没有任何反应。 我透露 GetExpressCheckoutDetails 和 DoExpressCheckoutPayment 都包含 CHECKOUTSTATUS=PaymentActionNotInitiated。根据Paypal integration - GetExpressCheckout “当您在买家登录 PayPal 帐户之前提交 GetExpressCheckoutDetails API 调用时,或者当他们登录他们的帐户,返回您的网站但尚未完成付款时,会出现 PaymentActionNotInitiated 的值。”

那“……但还没有完成付款”是什么意思?我假设 payear 在返回我的网站之前单击 Paypal 页面上的 Continue 按钮时批准了他的付款。因此,重定向后,我只需调用 GetExpressCheckoutDetails 以获取付款人的 ID,然后调用 DoExpressCheckoutPayment。付款人单击确认按钮只是为了走得更远。

由于 CHECKOUTSTATUS=PaymentActionNotInitiated 在重定向到站点后立即从 GetExpressCheckoutDetails 第一次发生,我可以预期付款人必须在 Paypal 页面上完成某些操作,然后继续单击并重定向到该站点。但没有别的了。有人可以评论吗?

下面是一个列表或 NVP 交换:

-- SetExpressCheckout Request --
https://api-3t.sandbox.paypal.com/nvp?Method=SetExpressCheckout&
VERSION=93.0&
USER=<facilitator's id>&
PWD=<facilitator's pwd>&
SIGNATURE=<facilitator's signature>&
PAYMENTREQUEST_0_PAYMENTACTION=SALE&
PAYMENTREQUEST_0_AMT=25.00&
PAYMENTREQUEST_0_CURRENCYCODE=USD&
RETURNURL=http%3a%2f%2flocalhost%3a3655%2faccount%2fconfirmpayment.aspx?im=11402062107&
CANCELURL=http%3a%2f%2flocalhost%3a3655%2f%3fr%3d1

-- SetExpressCheckout Response --
TOKEN=EC-6BF53699XL820525R&
TIMESTAMP=2014-02-06T10:07:08Z&
CORRELATIONID=b1c1c6199de7e&
ACK=Success&
VERSION=93.0&
BUILD=9605603

-- Redirect to PayPal --
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&
token=EC-6BF53699XL820525R

-- GetExpressCheckoutDetails Request --
https://api-3t.sandbox.paypal.com/nvp?Method=GetExpressCheckoutDetails&
VERSION=93.0&
USER=<facilitator's id>&
PWD=<facilitator's pwd>&
SIGNATURE=<facilitator's signature>&
TOKEN=EC-6BF53699XL820525R

-- GetExpressCheckoutDetails Response --
TOKEN=EC-6BF53699XL820525R&
CHECKOUTSTATUS=PaymentActionNotInitiated&
TIMESTAMP=2014-02-06T10:08:17Z&
CORRELATIONID=dcbb85815cdc4&
ACK=Success&
VERSION=93.0&
BUILD=9605603&
EMAIL=<payer's e-mail>&
PAYERID=ZXPJ82TPPFGQ6&
PAYERSTATUS=verified&
FIRSTNAME=Jonh&
LASTNAME=Doe&
COUNTRYCODE=US&
SHIPTONAME=Jonh Doe&
SHIPTOSTREET=1 Main St&
SHIPTOCITY=San Jose&
SHIPTOSTATE=CA&
SHIPTOZIP=95131&
SHIPTOCOUNTRYCODE=US&
SHIPTOCOUNTRYNAME=United States&
ADDRESSSTATUS=Confirmed&
CURRENCYCODE=USD&
AMT=25.00&
SHIPPINGAMT=0.00&
HANDLINGAMT=0.00&
TAXAMT=0.00&
INSURANCEAMT=0.00&
SHIPDISCAMT=0.00&
PAYMENTREQUEST_0_CURRENCYCODE=USD&
PAYMENTREQUEST_0_AMT=25.00&
PAYMENTREQUEST_0_SHIPPINGAMT=0.00&
PAYMENTREQUEST_0_HANDLINGAMT=0.00&
PAYMENTREQUEST_0_TAXAMT=0.00&
PAYMENTREQUEST_0_INSURANCEAMT=0.00&
PAYMENTREQUEST_0_SHIPDISCAMT=0.00&
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&
PAYMENTREQUEST_0_SHIPTONAME=Jonh Doe&
PAYMENTREQUEST_0_SHIPTOSTREET=1 Main St&
PAYMENTREQUEST_0_SHIPTOCITY=San Jose&
PAYMENTREQUEST_0_SHIPTOSTATE=CA&
PAYMENTREQUEST_0_SHIPTOZIP=95131&
PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=US&
PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME=United States&
PAYMENTREQUEST_0_ADDRESSSTATUS=Confirmed&
PAYMENTREQUESTINFO_0_ERRORCODE=0

-- DoExpressCheckoutPayment Request --
https://api-3t.sandbox.paypal.com/nvp?Method=DoExpressCheckoutPayment&
VERSION=93.0&
USER=<facilitator's id>&
PWD=<facilitator's pwd>&
SIGNATURE=<facilitator's signature>&
TOKEN=EC-6BF53699XL820525R&
PAYERID=ZXPJ82TPPFGQ6&
PAYMENTREQUEST_0_PAYMENTACTION=SALE&
PAYMENTREQUEST_0_AMT=25.00&
PAYMENTREQUEST_0_CURRENCYCODE=USD

-- DoExpressCheckoutPayment Response --
TOKEN=EC-6BF53699XL820525R&
CHECKOUTSTATUS=PaymentActionNotInitiated&
TIMESTAMP=2014-02-06T10:08:48Z&
CORRELATIONID=b8fc094441d51&
ACK=Success&
VERSION=93.0&
BUILD=9605603&
EMAIL=<payer's e-mail>&
PAYERID=ZXPJ82TPPFGQ6&
PAYERSTATUS=verified&
FIRSTNAME=Jonh&
LASTNAME=Doe&
COUNTRYCODE=US&
SHIPTONAME=Jonh Doe&
SHIPTOSTREET=1 Main St&
SHIPTOCITY=San Jose&
SHIPTOSTATE=CA&
SHIPTOZIP=95131&
SHIPTOCOUNTRYCODE=US&
SHIPTOCOUNTRYNAME=United States&
ADDRESSSTATUS=Confirmed&
CURRENCYCODE=USD&
AMT=25.00&
SHIPPINGAMT=0.00&
HANDLINGAMT=0.00&
TAXAMT=0.00&
INSURANCEAMT=0.00&
SHIPDISCAMT=0.00&
PAYMENTREQUEST_0_CURRENCYCODE=USD&
PAYMENTREQUEST_0_AMT=25.00&
PAYMENTREQUEST_0_SHIPPINGAMT=0.00&
PAYMENTREQUEST_0_HANDLINGAMT=0.00&
PAYMENTREQUEST_0_TAXAMT=0.00&
PAYMENTREQUEST_0_INSURANCEAMT=0.00&
PAYMENTREQUEST_0_SHIPDISCAMT=0.00&
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false
&PAYMENTREQUEST_0_SHIPTONAME=Jonh Doe&
PAYMENTREQUEST_0_SHIPTOSTREET=1 Main St&
PAYMENTREQUEST_0_SHIPTOCITY=San Jose&PAYMENTREQUEST_0_SHIPTOSTATE=CA&
PAYMENTREQUEST_0_SHIPTOZIP=95131&
PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=US&
PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME=United States&
PAYMENTREQUEST_0_ADDRESSSTATUS=Confirmed&
PMENTREQUESTINFO_0_ERRORCODE=0

【问题讨论】:

您解决了这个问题吗?我也有同样的问题。 【参考方案1】:

我遇到了同样的问题。

DoExpressCheckoutPayment 之后再次调用GetExpressCheckoutDetails 应该返回PaymentActionCompleted

当得到PaymentActionCompletedCHECKOUTSTATUS 时,响应将类似于:

TOKEN=EC%2d3LD60853SC435481J&
BILLINGAGREEMENTACCEPTEDSTATUS=0&
CHECKOUTSTATUS=PaymentActionCompleted&
TIMESTAMP=2015%2d01%2d28T17%3a03%3a01Z&
CORRELATIONID=c36f3ff4b39d2&
ACK=Success&
VERSION=93
&BUILD=15009693&
EMAIL=mysupersecretemailaddress,
PAYERID=H54VEN293PLFL&
PAYERSTATUS=verified&
FIRSTNAME=Test&
LASTNAME=User&COUNTRYCODE=GB&
CURRENCYCODE=GBP&
AMT=35%2e98&
SHIPPINGAMT=0%2e00&
HANDLINGAMT=0%2e00&
TAXAMT=0%2e00&
INSURANCEAMT=0%2e00&
SHIPDISCAMT=0%2e00&
PAYMENTREQUEST_0_CURRENCYCODE=GBP&
PAYMENTREQUEST_0_AMT=35%2e98&
PAYMENTREQUEST_0_SHIPPINGAMT=0%2e00&
PAYMENTREQUEST_0_HANDLINGAMT=0%2e00&
PAYMENTREQUEST_0_TAXAMT=0%2e00&
PAYMENTREQUEST_0_INSURANCEAMT=0%2e00&
PAYMENTREQUEST_0_SHIPDISCAMT=0%2e00&
PAYMENTREQUEST_0_TRANSACTIONID=3CU92636XH572882Y&
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&
PAYMENTREQUESTINFO_0_TRANSACTIONID=3CU92636XH572882Y&
PAYMENTREQUESTINFO_0_ERRORCODE=0

【讨论】:

【参考方案2】:

你可以这样调用,它会工作。

<?php
$padata                 =   '&TOKEN='.urlencode(_GET('token'));
$httpParsedResponseAr   = $this->PPHttpPost('GetExpressCheckoutDetails', $padata, PPL_API_USER, PPL_API_PASSWORD, PPL_API_SIGNATURE, PPL_MODE);
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))          
    $i = 0;
    $order_array = array();
    foreach(array_keys($httpParsedResponseAr) as $key) 
        if (strpos($key, 'L_PAYMENTREQUEST_0_NUMBER') !== false) 
            $_SESSION['order_no'][$i] = $httpParsedResponseAr[$key];
            $i++;
        
    

    if($httpParsedResponseAr['CHECKOUTSTATUS'] == 'PaymentActionNotInitiated') 
        $padata  =  '&TOKEN='.$httpParsedResponseAr['TOKEN'];
        $padata .=  '&PAYERID='.$httpParsedResponseAr['PAYERID'];
        $padata .=  '&PAYMENTREQUEST_0_PAYMENTACTION='.urlencode("SALE");
        
        //set item info here, otherwise we won't see product details later
        for($i = 0; $i < $count_order2; $i++) 
            $padata .=  '&L_PAYMENTREQUEST_0_NAME'.$i.'='.$httpParsedResponseAr['L_PAYMENTREQUEST_0_NAME'.$i];
            $padata .=  '&L_PAYMENTREQUEST_0_NUMBER'.$i.'='.$httpParsedResponseAr['L_PAYMENTREQUEST_0_NUMBER'.$i];
            $padata .=  '&L_PAYMENTREQUEST_0_DESC'.$i.'='.$httpParsedResponseAr['L_PAYMENTREQUEST_0_DESC'.$i];
            $padata .=  '&L_PAYMENTREQUEST_0_AMT'.$i.'='.$httpParsedResponseAr['L_PAYMENTREQUEST_0_AMT'.$i];
            $padata .=  '&L_PAYMENTREQUEST_0_QTY'.$i.'='.$httpParsedResponseAr['L_PAYMENTREQUEST_0_QTY'.$i];
        
        
        $padata .=  '&PAYMENTREQUEST_0_ITEMAMT='.$httpParsedResponseAr['PAYMENTREQUEST_0_ITEMAMT'];
        $padata .=  '&PAYMENTREQUEST_0_TAXAMT='.$httpParsedResponseAr['PAYMENTREQUEST_0_TAXAMT'];
        $padata .=  '&PAYMENTREQUEST_0_SHIPPINGAMT='.$httpParsedResponseAr['PAYMENTREQUEST_0_SHIPPINGAMT'];
        $padata .=  '&PAYMENTREQUEST_0_HANDLINGAMT='.$httpParsedResponseAr['PAYMENTREQUEST_0_HANDLINGAMT'];
        $padata .=  '&PAYMENTREQUEST_0_SHIPDISCAMT='.$httpParsedResponseAr['PAYMENTREQUEST_0_SHIPDISCAMT'];
        $padata .=  '&PAYMENTREQUEST_0_INSURANCEAMT='.$httpParsedResponseAr['PAYMENTREQUEST_0_INSURANCEAMT'];
        $padata .=  '&PAYMENTREQUEST_0_AMT='.$httpParsedResponseAr['PAYMENTREQUEST_0_AMT'];
        $padata .=  '&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode(PPL_CURRENCY_CODE);                 
        
        //We need to execute the "DoExpressCheckoutPayment" at this point to Receive payment from user.
        $httpResDoExpChkPay = $this->PPHttpPost('DoExpressCheckoutPayment', $padata);
        
        //Check if everything went ok..
        if("SUCCESS" == strtoupper($httpResDoExpChkPay["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpResDoExpChkPay["ACK"])) 
            echo '<h2>Success</h2>';
            echo 'Your Transaction ID : '.urldecode($httpResDoExpChkPay["PAYMENTINFO_0_TRANSACTIONID"]);
            
            //Sometimes Payment are kept pending even when transaction is complete. 
            //hence we need to notify user about it and ask him manually approve the transiction
            if('Completed' == $httpResDoExpChkPay["PAYMENTINFO_0_PAYMENTSTATUS"]) 
                echo '<div style="color:green">Payment Received! Your product will be sent to you very soon!</div>';
             elseif('Pending' == $httpResDoExpChkPay["PAYMENTINFO_0_PAYMENTSTATUS"])              
                echo '<div style="color:red">Transaction Complete, but payment may still be pending! '. 'If that\'s the case, You can manually authorize this payment in your <a target="_new" href="http://www.paypal.com">Paypal Account</a></div>';              
            

         else 
            echo '<div style="color:red"><b>Error : </b>'.urldecode($httpResDoExpChkPay["L_LONGMESSAGE0"]).'</div>';
            echo '<pre>';
            print_r($httpResDoExpChkPay);
            echo '</pre>';
                   

    
       

【讨论】:

以上是关于PaymentActionNotInitiated 何时进行 Express Checkout的主要内容,如果未能解决你的问题,请参考以下文章