PayPal order amount mismatch - Bundle test product

SKU: 324324.324.234.234.234.234.234
$36.36
Your price: $36.36

Child - 1

$12.12 $12.12

Child - 2

$12.12 $12.12

Child - 3

$12.12 $12.12

Stack Trace

System.AggregateException: One or more errors occurred. ({"name":"UNPROCESSABLE_ENTITY","details":[{"field":"/purchase_units/@reference_id=='dca36dd3-7a05-41dd-b8d7-8397c1bc95fb'/amount/value","value":"1799.00","issue":"AMOUNT_MISMATCH","description":"Should equal item_total + tax_total + shipping + handling + insurance - shipping_discount - discount."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"06dfe92233640","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-AMOUNT_MISMATCH","rel":"information_link","method":"GET"}]})
 ---> PayPalHttp.HttpException: {"name":"UNPROCESSABLE_ENTITY","details":[{"field":"/purchase_units/@reference_id=='dca36dd3-7a05-41dd-b8d7-8397c1bc95fb'/amount/value","value":"1799.00","issue":"AMOUNT_MISMATCH","description":"Should equal item_total + tax_total + shipping + handling + insurance - shipping_discount - discount."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"06dfe92233640","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-AMOUNT_MISMATCH","rel":"information_link","method":"GET"}]}
   at PayPalHttp.HttpClient.Execute[T](T req)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Nop.Plugin.Payments.PayPalAdvanced.Services.ServiceManager.HandleCheckoutRequest[TRequest,TResult](PayPalAdvancedSettings settings, TRequest request) in C:\BuildAgents\Agent01\Output\2\s\src\Plugins\Nop.Plugin.Payments.PayPalAdvanced\Services\ServiceManager.cs:line 259
   at Nop.Plugin.Payments.PayPalAdvanced.Services.ServiceManager.<>c__DisplayClass31_0.<CreateOrder>b__0() in C:\BuildAgents\Agent01\Output\2\s\src\Plugins\Nop.Plugin.Payments.PayPalAdvanced\Services\ServiceManager.cs:line 770
   at Nop.Plugin.Payments.PayPalAdvanced.Services.ServiceManager.HandleFunction[TResult](PayPalAdvancedSettings settings, Func`1 function) in C:\BuildAgents\Agent01\Output\2\s\src\Plugins\Nop.Plugin.Payments.PayPalAdvanced\Services\ServiceManager.cs:line 153

Reproducible steps

  1. Create a bundle item

    1. With multiple child items priced as specific to three digits after the decimal.

  2. Try to checkout, should see the The requested action could not be performed, semantically incorrect, or failed business validation. error.

Issue breakdown

Let’s assume

  1. the line item products price is 1.125

  2. if there’s four line items then they would be summed up to be 4.5, so the bundle item’s price would be 4.5

  3. But when calculating the price of individual line item is rounded up to 1.12 as per the store currency settings. Paypal sums up the line item totals as 4.48, hence the difference in total.

PayPal response for this error

{
    "name": "UNPROCESSABLE_ENTITY",
    "details": [
        {
            "field": "/purchase_units/@reference_id=='paypal_country_test_US_d6425cad-aa08-404f-ad0b-6c95de89bb0d'/amount/value",
            "value": "240.00",
            "issue": "AMOUNT_MISMATCH",
            "description": "Should equal item_total + tax_total + shipping + handling + insurance - shipping_discount - discount."
        }
    ],
    "message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
    "debug_id": "e509f4b7eb92a",
    "links": [
        {
            "href": "https://developer.paypal.com/docs/api/orders/v2/#error-AMOUNT_MISMATCH",
            "rel": "information_link",
            "method": "GET"
        }
    ]
}