Error:
"An error occurred setting up your cart for PayPal." In log I found following message "Error passing cart to PayPal." "The totals of the cart item amounts do not match order amounts."
This is because the the adjust price amount for the checkout attribute is not being added into paypal item list.
Fix:
Add the following code just before into
\Nop.Plugin.Payments.PayPalExpressCheckout\Services\PayPalOrderService.cs - > GetPaymentDetails
// checkout attributes
Customer customer = cart.GetCustomer();
if (customer != null)
{
var checkoutAttributesXml = customer.GetAttribute<string>(SystemCustomerAttributeNames.CheckoutAttributes, _genericAttributeService, _storeContext.CurrentStore.Id);
var caValues = _checkoutAttributeParser.ParseCheckoutAttributeValues(checkoutAttributesXml);
if (caValues != null)
{
foreach (var caValue in caValues)
{
if (caValue.PriceAdjustment > 0)
{
var checkoutAttrItem = new PaymentDetailsItemType
{
Name = caValue.Name,
Amount = caValue.PriceAdjustment.GetBasicAmountType(currencyCode),
Quantity = "1"
};
items.Add(checkoutAttrItem);
}
}
}
}