PayPalSmartPaymentButtons Error

8 months ago
I have an error trying to use this plugin - Error: Expected an order id to be passed.

I have checked the logs and there are many errors from PayPal API of this type:
            "field": "/purchase_units/@reference_id=='c319a32c-32f6-4b40-8d30-73faeec2beb1'/items/0/unit_amount/value",
            "value": "652,94",
            "location": "body",
            "issue": "INVALID_PARAMETER_SYNTAX",
            "description": "The value of a field does not conform to the expected format."

My project has german localization, so I would say the problem is the decimal formatting of sent values - comma instead of point.

Could you please fix this error.
7 months ago
If you don't get a reply form the team soon, you may want to create an issue:
7 months ago

I've had the same problem with the amount passed to PayPal.
In their reference guide, the validation pattern is:

As you said "problem is the decimal formatting".
Need to update the code to change the culture variant of the currency
In the ServiceManager
ItemTotal = new PayPalCheckoutSdk.Orders.Money { CurrencyCode = currency, Value = (_workContext.WorkingCurrency.Rate * itemTotal).ToString("F", CultureInfo.InvariantCulture) }

Another problem I faced is the phone number needs to be numerical only.  nopCommerce allows a "+" for example in the phone number, while PayPal does not.

Simply remove any non-numerical values from the phone number (billing and shipping) before passing to PayPal.
In the ServiceManager
var newPhone = new string(billingAddress.PhoneNumber.Where(c => char.IsDigit(c)).ToArray());

After fixing the two, I've haven't had an issue.

Hope this helps.