可能重复:
Paypal Checkout Express空购物车问题
我有一个问题贝宝快递检查。我使用了集成向导中的代码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 );
}
任何帮助都将不胜感激,提前谢谢。
除了这里的其他注释外,在从SetExpressCheckout:获得响应后重定向到PayPal时,请确保使用未记录的"useraction"选项
cmd=_express-checkout&useraction=commit&token=返回的令牌
以下是PayPal论坛对此参数的引用
在调用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