PayPal express checkout plugin - checkout attribute bug and fixes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
Customer getting following error while they click on 'Check out with PayPal' button on cart page if there is checkout attribute selected.

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);
                        }
                    }
                }
            }
8 years ago
Hi Shahdat,

Thanks! It'll be fixed soon!
8 years ago
Andrei,

For my case, checkout attribute are not related to order items. I have two checkout attributes one is for shipping insurance another one is for donation. So, I am passing the checkout attributes to paypal as separate line items.
8 years ago
We would like to have "order notes" attached to the order to go through with a PayPal Express order, i.e. I would like the colour to be red. Will this fix this?
8 years ago
Hi Shahdat,

Fixed. Thanks a lot!

P.S. Also updated the plugin to support TLS 1.2
7 years ago
Hi AM,
Just wondering if there's a branch or commit with the fix for this? I'd like to implement it before release?

Thanks,
Tom
7 years ago
Hi just wondering where I can find this fix. I'm still getting “An error occurred setting up your cart for PayPal"
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.