0

我正在添加 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.

请协助

4

1 回答 1

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)
    }
};
于 2012-08-17T13:11:10.233 回答