参数解析时Paypal错误
Posted
技术标签:
【中文标题】参数解析时Paypal错误【英文标题】:Paypal error during parameter parsing 【发布时间】:2012-05-15 23:33:26 【问题描述】:Paypal 显示错误
时间戳:2012-05-07T12:17:49Z 相关 ID:37a2b3f9a2901 确认:失败 版本:76.0 内置:2860716 L_ERRORCODE0:10413 L_SHORTMESSAGE0:由于参数无效,事务被拒绝。有关详细信息,请参阅其他错误消息。 L_LONGMESSAGE0:购物车项目总金额与订单金额不匹配。 L_SEVERITYCODE0:错误 但是我在参数解析过程中使用了
orderreview.php
的以下代码
$personName = $_REQUEST['PERSONNAME'];
$SHIPTOSTREET = $_REQUEST['SHIPTOSTREET'];
$SHIPTOCITY = $_REQUEST['SHIPTOCITY'];
$SHIPTOSTATE = $_REQUEST['SHIPTOSTATE'];
$SHIPTOCOUNTRYCODE = $_REQUEST['SHIPTOCOUNTRYCODE'];
$SHIPTOZIP = $_REQUEST['SHIPTOZIP'];
$count = $_REQUEST['COUNT'];
$shippingch = $_REQUEST['shipping_charge'];
$L_NAME = 'L_NAME';
$itemamt = 0.00;
$itemstr = '';
$amtstr = '';
$qtystr = '';
for($i=0; $i<=$count; $i++)
$temp_lname = 'L_NAME'.$i;
$temp_lamt = 'L_AMT'.$i;
$temp_lqty = 'L_QTY'.$i;
$$temp_lname = $_REQUEST['L_NAME'.$i];
$$temp_lamt = $_REQUEST['L_AMT'.$i];
$$temp_lqty = $_REQUEST['L_QTY'.$i];
$itemamt=($itemamt+($$temp_lqty*$$temp_lamt));
$itemstr.='&L_NAME'.$i.'='.$_REQUEST['L_NAME'.$i];
$amtstr.='&L_AMT'.$i.'='.$_REQUEST['L_AMT'.$i];
$qtystr.='&L_QTY'.$i.'='.$_REQUEST['L_QTY'.$i];
$returnURL =urlencode($url.'/ReviewOrder.php?currencyCodeType='.$currencyCodeType.'&paymentType='.$paymentType);
$cancelURL =urlencode("$url/SetExpressCheckout.php?paymentType=$paymentType" );
$shiptoAddress = "&SHIPTONAME=$personName&SHIPTOSTREET=$SHIPTOSTREET&SHIPTOCITY=$SHIPTOCITY&SHIPTOSTATE=$SHIPTOSTATE&SHIPTOCOUNTRYCODE=$SHIPTOCOUNTRYCODE&SHIPTOZIP=$SHIPTOZIP";
$nvpstr="&ADDRESSOVERRIDE=1$shiptoAddress".$itemstr."".$amtstr."".$qtystr."&MAXAMT=".(string)$maxamt."&AMT=".(string)$amt."&ITEMAMT=".(string)$itemamt."&CALLBACKTIMEOUT=4&L_SHIPPINGOPTIONAMOUNT1=$shippingch&L_SHIPPINGOPTIONlABEL1=UPS Next Day Air&L_SHIPPINGOPTIONNAME1=UPS Air&L_SHIPPINGOPTIONISDEFAULT1=true&L_SHIPPINGOPTIONAMOUNT0=$shippingch&L_SHIPPINGOPTIONLABEL0=UPS Ground 7 Days&L_SHIPPINGOPTIONNAME0=Ground&L_SHIPPINGOPTIONISDEFAULT0=false&INSURANCEAMT=1.00&INSURANCEOPTIONOFFERED=true&CALLBACK=https://www.ppcallback.com/callback.pl&SHIPPINGAMT=$shippingch&SHIPDISCAMT=-3.00&TAXAMT=2.00&L_NUMBER0=1000&L_DESC0=Size: 8.8-oz&L_NUMBER1=10001&L_DESC1=Size: Two 24-piece boxes&L_ITEMWEIGHTVALUE1=0.5&L_ITEMWEIGHTUNIT1=lbs&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL ."&CURRENCYCODE=".$currencyCodeType."&PAYMENTACTION=".$paymentType;
如果我使用硬编码为 8.00 的运费,则此代码有效。
可能是什么问题?
【问题讨论】:
【参考方案1】:如果您收到此错误,请确保付款明细项目参数(如 ItemTotal、HandlingTotal、TaxTotal 等)的总和等于订单总数。
【讨论】:
以上是关于参数解析时Paypal错误的主要内容,如果未能解决你的问题,请参考以下文章
Paypal API - checkout.js - 解析响应错误
Paypal 快递付款错误 SetExpressCheckout 失败:无法解析主机:api-3t(6)
AWS Lambda 错误:当 url 参数包含 JSON 数组时,“无法将请求正文解析为 json”