2011-11-07 71 views
1

可能重複:
Paypal Checkout Express empty cart problem寶空白訂單彙總

我擁有PayPal expresscheckout的問題。 我用集成嚮導https://www.paypal-labs.com/integrationwizard/ecpaypal/main.php的代碼,一切工作正常,但是當我重定向到貝寶我想要有一個像貝寶的頁面上的總量和種類描述的訂單總結,但在我的情況下它的空白(如在此屏幕上http://imageshack.us/photo/my-images/819/blankv.png/)我可以把我的代碼片段,我使用:

    // ================================== 
        // PayPal Express Checkout Module 
        // ================================== 

        //'------------------------------------ 
        //' The paymentAmount is the total value of 
        //' the shopping cart, that was set 
        //' earlier in a session variable 
        //' by the shopping cart page 
        //'------------------------------------ 
        $paymentAmount = $_SESSION["Payment_Amount"]; 

        //'------------------------------------ 
        //' When you integrate this code 
        //' set the variables below with 
        //' shipping address details 
        //' entered by the user on the 
        //' Shipping page. 
        //'------------------------------------ 

        $sql = "SELECT * FROM orders_shipping_address WHERE orderid={$_SESSION['orderId']}"; 
        $shipping_address = $this->db->query($sql)->fetchAll(); 

        $shipToName = $shipping_address[0]['lastname'] . " " . $shipping_address[0]['firstname']; 
        $shipToStreet = $shipping_address[0]['street1']; 
        $shipToStreet2 = $shipping_address[0]['street2']; //Leave it blank if there is no value 
        $shipToCity = $shipping_address[0]['city']; 
        $shipToState = "Romania"; 
        $shipToCountryCode = "RO"; // Please refer to the PayPal country codes in the API documentation 
        $shipToZip = $shipping_address[0]['zip']; 
        $phoneNum = $shipping_address[0]['phone']; 

        //'------------------------------------ 
        //' The currencyCodeType and paymentType 
        //' are set to the selections made on the Integration Assistant 
        //'------------------------------------ 
        $currencyCodeType = $_SESSION['currencyCodeType'] = "EUR"; 
        $paymentType = $_SESSION['PaymentType'] = "Sale"; 

        //'------------------------------------ 
        //' The returnURL is the location where buyers return to when a 
        //' payment has been succesfully authorized. 
        //' 
        //' This is set to the value entered on the Integration Assistant 
        //'------------------------------------ 
        $returnURL = $ret; 

        //'------------------------------------ 
        //' The cancelURL is the location buyers are sent to when they hit the 
        //' cancel button during authorization of payment during the PayPal flow 
        //' 
        //' This is set to the value entered on the Integration Assistant 
        //'------------------------------------ 
        $cancelURL = $cancel; 

        //'------------------------------------ 
        //' Calls the SetExpressCheckout API call 
        //' 
        //' The CallMarkExpressCheckout function is defined in the file PayPalFunctions.php, 
        //' it is included at the top of this file. 
        //'------------------------------------------------- 
        $resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, 
                                $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, 
                                $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum 
       ); 

        $ack = strtoupper($resArray["ACK"]); 
        if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") 
        { 
          //dump($resArray); 
          //die; 
          $token = urldecode($resArray["TOKEN"]); 
          $_SESSION['reshash']=$token; 
          RedirectToPayPal ($token); 
        } 

任何幫助將是非常apreciated,在此先感謝。

回答

3

在致電SetExpressCheckout之前,您需要將項目添加到nvp字符串。下面

額外的參數添加兩個產品:

 &L_PAYMENTREQUEST_0_NAME0=productname 
     &L_PAYMENTREQUEST_0_NUMBER0=productcode 
     &L_PAYMENTREQUEST_0_DESC0=product-description 
     &L_PAYMENTREQUEST_0_AMT0=productamount 
     &L_PAYMENTREQUEST_0_QTY0=product-unit-price 
     &L_PAYMENTREQUEST_0_NAME1=productname 
     &L_PAYMENTREQUEST_0_NUMBER1=productcode 
     &L_PAYMENTREQUEST_0_DESC1=product-description 
     &L_PAYMENTREQUEST_0_AMT1=productamount 
     &L_PAYMENTREQUEST_0_QTY1=product-unit-price 
+2

此數據也需要包含在DoExpressCheckoutPayment中,如果您希望它出現在買方的交易詳情以及您自己的交易歷史記錄中。 – Robert

4

除了這裏的其他意見,可以肯定,當你重定向到PayPal使用無證「useraction」選項正從SetExpressCheckout響應後:

?CMD = _express結賬& useraction =提交 &令牌=的-返回令牌

Here's the PayPal forum reference to this parameter

+3

「請務必在同一句話中使用」和「無證」恐嚇我 – Flexo

+2

是的Flexy,證明PayPals文檔是多麼糟糕.. – teecee

+0

這讓我非常難過,這是解決方案。但是,我很高興你發佈它。這裏沒有提到他們的例子:https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECGettingStarted/#idde509e1a-af2a-412a-b9ab-829b844986c5 – Grallen