我正在添加20.00的项目并将订单总数设置为22.00
paymentDetails.OrderTotal = new PayPalSandboxWS.BasicAmountType()
{
currencyID = ConvertProgramCurrencyToPayPalSandbox(currency),
Value = "22.00"
};
并将运费总额设为2.00
paymentDetails.ShippingTotal = new PayPalSandboxWS.BasicAmountType()
{
currencyID = ConvertProgramCurrencyToPayPalSandbox(currency),
Value = "2.00"
};
但我收到此错误:The totals of the cart item amounts do not match order amounts.
请协助
答案 0 :(得分:1)
您错过了设置ItemTotal
值!这导致了这个错误:
double itemTot = 20.0;
double tot = 22.0;
double shipping = 2.0;
string desc = "";
var paymentDetailsItemTypes = new List<PaymentDetailsItemType>();
PaymentDetailsType pdt = new PaymentDetailsType()
{
OrderDescription = desc,
OrderTotal = new BasicAmountType()
{
currencyID = CurrencyCodeType.EUR,
Value = tot.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)
},
PaymentDetailsItem = paymentDetailsItemTypes.ToArray(),
ShippingTotal = new BasicAmountType()
{
currencyID = CurrencyCodeType.EUR,
Value = shipping.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)
},
ItemTotal = new BasicAmountType()
{
currencyID = CurrencyCodeType.EUR,
Value = itemTot.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)
}
};