开发者

php paypal express checkout problem

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";
$returnU开发者_如何学GoRL = "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"] );

} 


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜