PaymentActionNotInitiated什么时候快速结账

时间:2014-02-07 01:16:52

标签: express-checkout

我玩Sandbox将Express Checkout放到我的网站上。 Eveyrthing运行良好:用户单击付款按钮,重定向到paypal,使用Sandbox买家的凭据登录到他的沙盒页面,单击继续按钮,最后重定向回我的站点,只需单击确认按钮。但Sandbox Seller和Byer测试帐户的趣味没有任何反应。 我透露GetExpressCheckoutDetails和DoExpressCheckoutPayment都包含CHECKOUTSTATUS = PaymentActionNotInitiated。根据{{​​3}} “当您在买家登录PayPal帐户或登录其帐户,返回您的网站但尚未完成付款之前提交GetExpressCheckoutDetails API调用时,会发生PaymentActionNotInitiated的值。”

然后是什么意思“......但尚未完成付款”?我假设payear在Paypal页面点击“继续”按钮之前批准了他的付款,然后返回我的网站。因此,在重定向后,我只需调用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

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。

GetExpressCheckoutDetails之后再次呼叫DoExpressCheckoutPayment应该返回PaymentActionCompleted

获取CHECKOUTSTATUS的{​​{1}}时,响应类似于:

PaymentActionCompleted

答案 1 :(得分:0)

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

<?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>';
        }           

    }
}