gpt4 book ai didi

c# - 与错误代码 : 10413 集成的购物车运费

转载 作者:太空宇宙 更新时间:2023-11-03 16:36:07 30 4
gpt4 key购买 nike

我正在尝试通过沙盒为我的网站整合payapl

我可以将多个项目发送到 paypal 并且工作正常。但是我想设置 CART-WIDE 运费并将其发送到 paypal

我收到错误代码:

10413(“ErrorCode=10413&Desc=交易因参数无效而被拒绝。有关详细信息,请参阅其他错误消息。&Desc2=购物车商品总金额与订单金额不匹配。”)

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

关于c# - 与错误代码 : 10413 集成的购物车运费,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14279207/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com