我想整合payapl通過沙箱爲我的網站。購物車寬運費與集成錯誤代碼:10413
我可以發送多個項目貝寶它工作正常。但我想設置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;
這裏是獲取發送到貝寶
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
我覺得我對整個車分配錯誤的變量運費查詢。
你搖滾的人...。你讓我很快樂...我希望有人總有一天會實際上看到我的問題和關心回答...我喜歡你解釋的方式...... +1 –