与错误代码:10413集成的购物车广泛运输成本
本文关键字:运输 购物车 错误代码 10413 集成 | 更新日期: 2023-09-27 17:51:16
我正试图通过沙箱为我的网站整合payapl。
我能够发送多个项目到贝宝,它的工作很好。然而,我想设置CART-WIDE运输成本,并将其发送到paypal。
我得到错误代码:
10413 ("ErrorCode=10413&Desc=Transaction refused because of an invalid argument. See additional error messages for details.& Desc2=The totals of the cart item amounts do not match order amounts.")
My CART:
Item: Mens Jackets
Price: 14.99
DESC: "SAMPLE"
QTY: 1
ITEM TOTAL: 14.99
SHIPPING: 5.99
CART TOTAL: 20.94
我正在设置以下变量,我不知道我做错了什么。
NVPCodec encoder = new NVPCodec();
encoder["METHOD"] = "SetExpressCheckout";
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["BRANDNAME"] = "Mountain Warehouse Sample Application";
encoder["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
encoder["PAYMENTREQUEST_0_CURRENCYCODE"] = "GBP";
// Get the Shopping Cart Products
int i = 0;
Decimal totalItemAmt = 0.00M;
string cartShippingAmt = "";
foreach (BasketItem item in basket.Items)
{
if (item.OrderItemType == OrderItemType.Product)
{
encoder["L_PAYMENTREQUEST_0_NAME" + i] = item.Name.ToString();
encoder["L_PAYMENTREQUEST_0_AMT" + i] = item.Price.ToString("0.00");
encoder["L_PAYMENTREQUEST_0_QTY" + i] = item.Quantity.ToString();
i++;
totalItemAmt += Convert.ToDecimal(item.Price.ToString("0.00"));
}
if (item.OrderItemType == OrderItemType.Shipping)
{
cartShippingAmt = item.Price.ToString("0.00");
}
}
encoder["PAYMENTREQUEST_0_ITEMAMT"] = totalItemAmt.ToString();
encoder["PAYMENTREQUEST_0_AMT"] = amt;
encoder["HANDLING_CART"] = cartShippingAmt;
这是发送到paypal
的查询METHOD=SetExpressCheckout&
RETURNURL=http%3a%2f%2flocalhost%3a1234%2fCheckout%2fCheckoutReview.aspx&
CANCELURL=http%3a%2f%2flocalhost%3a1234%2fCheckout%2fCheckoutCancel.aspx&
BRANDNAME=Sample+Application&
PAYMENTREQUEST_0_PAYMENTACTION=Sale&
PAYMENTREQUEST_0_CURRENCYCODE=GBP&
L_PAYMENTREQUEST_0_NAME0=MENS+JACKETS&
L_PAYMENTREQUEST_0_AMT0=14.99&
L_PAYMENTREQUEST_0_QTY0=1&
PAYMENTREQUEST_0_ITEMAMT=14.99&
HANDLING_CART=5.95&
PAYMENTREQUEST_0_AMT=20.94
我想我分配了错误的整个购物车的可变运输成本。
你这里有几处不对。
首先,您使用的一些请求参数不正确。HANDLING_CART不是一个有效的请求参数。我认为您在那里寻找的是HANDLINGAMT(实际上是PAYMENTREQUEST_0_HANDLINGAMT)。
每次付款,ITEMAMT + SHIPPINGAMT + HANDLINGAMT + TAXAMT的总和需要等于AMT。在您的情况下,PayPal忽略了您发送的无效参数,因此它最终会看到以下内容:
PAYMENTREQUEST_0_ITEMAMT = 14.99PAYMENTREQUEST_0_AMT = 20.94
它没有看到你的处理量,因为该参数无效,因此,总数与它们所看到的不匹配。您只需要将HANDLING_CART更改为PAYMENTREQUEST_0_HANDLINGAMT,这应该可以解决您的问题。
下面是一个工作的SetExpressCheckout请求的示例,包含多个项目和一些额外的选项…
[USER] => ****
[PWD] => ****
[VERSION] => 97.0
[BUTTONSOURCE] => AngellEYE_PHPClass
[SIGNATURE] => ****
[METHOD] => SetExpressCheckout
[MAXAMT] => 200.00
[RETURNURL] => http://paypal.angelleye.com/standard/samples/DoExpressCheckoutPayment.php
[CANCELURL] => http://paypal.angelleye.com/paypal/class/cancel.php
[ALLOWNOTE] => 1
[HDRIMG] => http://paypal.angelleye.com/images/hdrimg.jpg
[SOLUTIONTYPE] => Sole
[LANDINGPAGE] => Billing
[BRANDNAME] => Angell EYE
[CUSTOMERSERVICENUMBER] => 555-555-5555
[GIFTMESSAGEENABLE] => 1
[GIFTRECEIPTENABLE] => 1
[GIFTWRAPENABLE] => 1
[GIFTWRAPNAME] => Box with Ribbon
[GIFTWRAPAMOUNT] => 2.50
[BUYEREMAILOPTIONENABLE] => 1
[SURVEYQUESTION] => Did you like this checkout?
[SURVEYENABLE] => 1
[BUYERREGISTRATIONDATE] => 2012-07-14T00:00:00Z
[L_SURVEYCHOICE0] => Yes
[L_SURVEYCHOICE1] => No
[PAYMENTREQUEST_0_AMT] => 100.00
[PAYMENTREQUEST_0_CURRENCYCODE] => USD
[PAYMENTREQUEST_0_ITEMAMT] => 80.00
[PAYMENTREQUEST_0_SHIPPINGAMT] => 15.00
[PAYMENTREQUEST_0_TAXAMT] => 5.00
[PAYMENTREQUEST_0_DESC] => This is a test order.
[PAYMENTREQUEST_0_NOTETEXT] => This is a test note before ever having left the web site.
[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[L_PAYMENTREQUEST_0_NAME0] => Widget 123
[L_PAYMENTREQUEST_0_DESC0] => Widget 123
[L_PAYMENTREQUEST_0_AMT0] => 40.00
[L_PAYMENTREQUEST_0_NUMBER0] => 123
[L_PAYMENTREQUEST_0_QTY0] => 1
[L_PAYMENTREQUEST_0_ITEMURL0] => http://www.angelleye.com/products/123.php
[L_PAYMENTREQUEST_0_NAME1] => Widget 456
[L_PAYMENTREQUEST_0_DESC1] => Widget 456
[L_PAYMENTREQUEST_0_AMT1] => 40.00
[L_PAYMENTREQUEST_0_NUMBER1] => 456
[L_PAYMENTREQUEST_0_QTY1] => 1
[L_PAYMENTREQUEST_0_ITEMURL1] => http://www.angelleye.com/products/456.php