0

I am adding an item of 20.00 and setting the order total to 22.00

 paymentDetails.OrderTotal = new PayPalSandboxWS.BasicAmountType()
     {
         currencyID = ConvertProgramCurrencyToPayPalSandbox(currency),
         Value = "22.00"
     };

and setting the shipping total to 2.00

 paymentDetails.ShippingTotal = new PayPalSandboxWS.BasicAmountType()
     {
         currencyID = ConvertProgramCurrencyToPayPalSandbox(currency),
         Value = "2.00"
     };

But I am getting this error: The totals of the cart item amounts do not match order amounts.

Please assist

JP Hellemons
  • 5,977
  • 11
  • 63
  • 128
vakas
  • 1,799
  • 5
  • 23
  • 40
  • I have exactly the same and was wondering if you have found a solution? Can't find anything in the docs about it: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout – JP Hellemons Aug 17 '12 at 12:22
  • Do you also have: SetExpressCheckoutRequestDetailsType sdt = new SetExpressCheckoutRequestDetailsType(); sdt.ShippingMethod = ShippingServiceCodeType.CustomCode; sdt.ShippingMethodSpecified = true; – JP Hellemons Aug 17 '12 at 12:29

1 Answers1

1

You missed setting the ItemTotal value! That caused this erorr:

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)
    }
};
JP Hellemons
  • 5,977
  • 11
  • 63
  • 128