php paypal快速结账问题

2021-12-29 00:00:00 php paypal express-checkout

我正在尝试在我的网站上集成贝宝快速结账功能.我试图使用沙箱进行检查.当我从我的站点令牌提交数据时,生成的数据没有错误,但是当重定向到 paypal 时,它没有显示付款金额.顺便说一句,我正在使用贝宝快速结账向导中的代码.如果有人指出我正确的方向会很有帮助.

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"] );

} 

推荐答案

由于您没有传递所谓的订单项详细信息"(产品数据),因此 PayPal 不会显示总金额.

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

如果您只想显示当前购买的金额,请将买家重定向至 https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-xxxxxx&useraction=commit(而不是https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-xxxxx)

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)

如果您想开始向 PayPal 发送订单项详细信息,请在您的 SetExpressCheckout API 请求中包含以下内容:

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 

如果您也想在自己的历史记录中看到这一点,您还需要将其包含在 DoExpressCheckoutPayment 中.

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

相关文章