• Resolved trogdoor9432

    (@trogdoor9432)


    Hi, I’m using version 1.0.16 of the plugin and occasionally I’m getting an error: AMOUNT_MISMATCH.

    Ive included my debug log below. As you will see, my line items add up to 218.99, but the total amount charged is 219.00.?

    I have “Round tax at subtotal level, instead of rounding per line” setting in WooCommerce enabled – I think that may be part of the issue, however I would like to use the PayPal plugin with this setting on.

    I can see in version 1.0.16 of the plugin some work was done to fix an error related to ITEM_TOTAL_MISMATCH – so maybe this is a similar error (I also added a reply to the thread where this was highlighted, apologies for the duplication)

    Would you be able to have a look at this please?

    Many thanks

    2022-12-14T18:00:56+00:00 ERROR API error: Array
    (
        [url] => https://api-m.paypal.com/v2/checkout/orders/[redacted]
        [method] => PATCH
        [request] => Array
    (
        [0] => Array
            (
                [op] => replace
                [path] => /purchase_units/@reference_id=='default'
                [value] => Array
                    (
                        [amount] => Array
                            (
                                [value] => 219.00
                                [currency_code] => GBP
                                [breakdown] => Array
                                    (
                                        [item_total] => Array
                                            (
                                                [currency_code] => GBP
                                                [value] => 209.60
                                            )
                                        [shipping] => Array
                                            (
                                                [currency_code] => GBP
                                                [value] => 9.52
                                            )
                                        [tax_total] => Array
                                            (
                                                [currency_code] => GBP
                                                [value] => 10.43
                                            )
                                        [discount] => Array
                                            (
                                                [currency_code] => GBP
                                                [value] => 10.56
                                            )
                                        [handling] => Array
                                            (
                                                [currency_code] => GBP
                                                [value] => 0.00
                                            )
                                    )
                            )
                        [invoice_id] => [redacted]
                        [custom_id] => [redacted]
                        [items] => Array
                            (
                                [0] => Array
                                    (
                                        [name] => [redacted]
                                        [quantity] => 20
                                        [unit_amount] => Array
                                            (
                                                [currency_code] => GBP
                                                [value] => 10.48
                                            )
                                    )
                            )
                        [description] => [redacted]
                        [shipping] => [redacted]
                        [reference_id] => default
                    )
            )
    )
    
        [error] => Array
            (
                [name] => UNPROCESSABLE_ENTITY
                [details] => Array
                    (
                        [0] => Array
                            (
                                [field] => /purchase_units/@reference_id=='default'/amount/value
                                [value] => 219.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] => 1eed400835ac8
                [links] => Array
                    (
                        [0] => Array
                            (
                                [href] => https://developer.paypal.com/docs/api/orders/v2/#error-AMOUNT_MISMATCH
                                [rel] => information_link
                                [method] => GET
                            )
                    )
            )
    )
Viewing 1 replies (of 1 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @trogdoor9432

    Please ensure you are using the latest version of the plugin which is 1.0.17. That should resolve that API error you’re seeing.

    This can happen because PayPal’s API limits all amounts to 2 decimal places, but WooCommerce uses more decimals than that during the cart calculation. Because PayPal’s API doesn’t have the same precision, the amounts in some scenarios can be off by a cent or two.

    Kind Regards,

Viewing 1 replies (of 1 total)
  • The topic ‘AMOUNT_MISMATCH error’ is closed to new replies.