php paypal express checkout problem

China☆狼群 提交于 2020-01-11 02:29:06

问题


I'm trying to integrate paypal express checkout on my website. I was trying to check using sandbox. When I submit data from my site token is generated with no error but when redirected to paypal it's not showing payment amount. btw I'm using the code from paypal express checkout wizard. It will be helpful if some one points me to correct direction.

require_once ("paypalfunctions.php");

$paymentAmount = 15;

$currencyCodeType = "GBP";
$paymentType = "Sale";
$returnURL = "http://www.mysite.com/paypal/confirm.php";
$cancelURL = "http://www.mysite.com/paypal/index.php";
$resArray = CallShortcutExpressCheckout ($paymentAmount, $currencyCodeType,            $paymentType, $returnURL, $cancelURL);
$ack = strtoupper($resArray["ACK"]);
if($ack=="SUCCESS")
{
RedirectToPayPal ( $resArray["TOKEN"] );

} 

回答1:


As you're not passing so called 'line item details' (product data), PayPal doesn't display the total amount.

If you only want to show the amount for the current purchase, redirect buyers to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-xxxxxx&useraction=commit (instead of https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-xxxxx)

If you want to start sending line-item details to PayPal, include the following in your SetExpressCheckout API request:

// Total amount of the purchase, incl shipping, tax, etc  
PAYMENTREQUEST_0_AMT=300.0  
// Total amount of items purchased, excl shipping, tax, etc     
PAYMENTREQUEST_0_ITEMAMT=300.0  
// Authorize the funds first (Authorization), or capture immediately (Sale)?    
PAYMENTREQUEST_0_PAYMENTACTION=Sale  
// First item  
L_PAYMENTREQUEST_0_NAME0=Item1  
L_PAYMENTREQUEST_0_QTY0=1  
L_PAYMENTREQUEST_0_AMT0=100.00  
// Second item  
L_PAYMENTREQUEST_0_NAME1=Item2  
L_PAYMENTREQUEST_0_QTY1=1  
L_PAYMENTREQUEST_0_AMT1=200.00 

If you want to see this in your own history as well, you'll also need to include this in DoExpressCheckoutPayment.



来源:https://stackoverflow.com/questions/7572878/php-paypal-express-checkout-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!