• Resolved Ferhat1986

    (@ferhat1986)


    Hi,

    I have a clean WordPress WooCommerce environment where i’m testing an issue I have. I have the following WooCommerce settings:
    – Enabled taxes
    – Currency options > Number of decimals: 0

    Now I have products like 349,95 which is rounded up and shown as 350 because i’ve disabled the decimals. This is all working great until I start the Mollie payment. So I’ve checked the debug logs and this is what I get:

    2025-08-04T15:23:39+00:00 Foutopsporing [2025-08-04T15:23:39+0000] Error executing API call (422: Unprocessable Entity): Line item 1 is invalid. The ‘vatAmount’ field is off. Expected to be €95.38 (€549.55 × (21.00 / 121.00)), got €95.00. Documentation: https://docs.mollie.com/reference/handling-errors. Request body: {“status”:422,”title”:”Unprocessable Entity”,”detail”:”Line item 1 is invalid. The ‘vatAmount’ field is off. Expected to be €95.38 (€549.55 × (21.00 / 121.00)), got €95.00″,”field”:”lines.1.vatAmount”,”_links”:{“documentation”:{“href”:”https://docs.mollie.com/reference/handling-errors”,”type”:”text/html”}}}. Field: lines.1.vatAmount

    2025-08-04T15:23:39+00:00 Foutopsporing ideal: Failed to create Mollie payment object for order 8123: [2025-08-04T15:23:39+0000] Error executing API call (422: Unprocessable Entity): Line item 1 is invalid. The ‘vatAmount’ field is off. Expected to be €95.38 (€549.55 × (21.00 / 121.00)), got €95.00. Documentation: https://docs.mollie.com/reference/handling-errors. Request body: {“status”:422,”title”:”Unprocessable Entity”,”detail”:”Line item 1 is invalid. The ‘vatAmount’ field is off. Expected to be €95.38 (€549.55 × (21.00 / 121.00)), got €95.00″,”field”:”lines.1.vatAmount”,”_links”:{“documentation”:{“href”:”https://docs.mollie.com/reference/handling-errors”,”type”:”text/html”}}}. Field: lines.1.vatAmount

    As you can see the amount sent to Mollie doesn’t correspond with the amount which Mollie calculates. This is the POST data:

    {
        "amount": {
            "currency": "EUR",
            "value": "550.00"
        },
        "description": "Bestelling XXXX",
        "redirectUrl": "https://xxxxx/afrekenen/order-received/XXXX/?key=wc_order_XXXX&order_id=XXXX&filter_flag=onMollieReturn",
        "webhookUrl": "https://xxxxx/wc-api/mollie_wc_gateway_ideal?order_id=XXXX&key=wc_order_XXXX&filter_flag",
        "method": "ideal",
        "issuer": "",
        "locale": "nl_NL",
        "dueDate": "",
        "metadata": {
            "order_id": XXXX
        }
    }

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Femi

    (@femiyb)

    Hello @ferhat1986

    We have released a beta package that should resolve this issue. You can download the beta package here: https://github.com/mollie/WooCommerce/releases/tag/8.0.5-beta2

    This fix will be included in the next release.

    Please let me know if this works for you.

    Regards,
    Femi.

    Thread Starter Ferhat1986

    (@ferhat1986)

    Hi Femy,

    Thnx for the reply. We still get the same error:

    2025-08-05T12:11:41+00:00 Debug [2025-08-05T12:11:41+0000] Error executing API call (422: Unprocessable Entity): Line item 1 is invalid. The 'vatAmount' field is off. Expected to be €137.09 (€789.89 × (21.00 / 121.00)), got €137.00. Documentation: https://docs.mollie.com/reference/handling-errors. Request body: {"status":422,"title":"Unprocessable Entity","detail":"Line item 1 is invalid. The 'vatAmount' field is off. Expected to be €137.09 (€789.89 × (21.00 / 121.00)), got €137.00","field":"lines.1.vatAmount","_links":{"documentation":{"href":"https://docs.mollie.com/reference/handling-errors","type":"text/html"}}}. Field: lines.1.vatAmount
    2025-08-05T12:11:41+00:00 Debug ideal: Failed to create Mollie payment object for order 296295: [2025-08-05T12:11:41+0000] Error executing API call (422: Unprocessable Entity): Line item 1 is invalid. The 'vatAmount' field is off. Expected to be €137.09 (€789.89 × (21.00 / 121.00)), got €137.00. Documentation: https://docs.mollie.com/reference/handling-errors. Request body: {"status":422,"title":"Unprocessable Entity","detail":"Line item 1 is invalid. The 'vatAmount' field is off. Expected to be €137.09 (€789.89 × (21.00 / 121.00)), got €137.00","field":"lines.1.vatAmount","_links":{"documentation":{"href":"https://docs.mollie.com/reference/handling-errors","type":"text/html"}}}. Field: lines.1.vatAmount

    Strange thing is that the VAT is also getting rounded. The product price should be 790 incl VAT
    VAT should be 137,11 but also gets rounded to 137

    Plugin Support Femi

    (@femiyb)

    Hello @ferhat1986

    Looked into this further. The problem occurs in the order lines processing system where WooCommerce displays products as €350 (rounded from €349.95) but Mollie expects precise VAT calculations based on the actual €349.95 price. OrderLines.php:159-163 The vatAmount field is calculated using WooCommerce’s internal tax amounts, which may not align with Mollie’s validation formula.

    To resolve this without any custom code changes, we recommend updating your WooCommerce settings to preserve precision in your price calculations. Here’s how:

    1. Go to WooCommerce > Settings > General
    2. Scroll to Currency options
    3. Change “Number of decimals” from 0 to 2

    This change ensures that the full product prices (e.g., €349.95) are used throughout the calculation process and sent to Mollie, which should prevent the VAT mismatch errors you’re encountering.

    Please let me know if this works.

    Regards,
    Femi.

    Thread Starter Ferhat1986

    (@ferhat1986)

    Hi Femi,

    This option is what is causing the problem. We purposely set the decimals to 0. We don’t want to show decimals in our webshop.

    Isn’t there a way to make the plugin work with decimals set to 0?

    Greetings,
    Ferhat

    Thread Starter Ferhat1986

    (@ferhat1986)

    Some extra information

    I have set the decimals to 0
    I have a product which is priced on 350,00 exactly including 21% taxes

    So the price is as following:
    Product price excluding taxes (21%): €289,26
    Tax (21%): €60,74
    Product price including taxes (21%): €350

    When trying to pay this order (€350 incl €61 taxes) the error log says the same:

    2025-08-13T08:43:44+00:00 Foutopsporing {
        "amount": {
            "currency": "EUR",
            "value": "350.00"
        },
        "description": "Bestelling ",
        "redirectUrl": "https://xxxx.com/betalen/order-received/xxxx/?key=xxxx&order_id=xxxx&filter_flag=onMollieReturn",
        "webhookUrl": "https://xxxx.com/wc-api/mollie_wc_gateway_ideal?order_id=xxxx&key=xxxx&filter_flag",
        "method": "ideal",
        "issuer": "",
        "locale": "nl_NL",
        "dueDate": "",
        "metadata": {
            "order_id": xxxx
        }
    }
    2025-08-13T08:43:45+00:00 Foutopsporing [2025-08-13T08:43:45+0000] Error executing API call (422: Unprocessable Entity): Line item 1 is invalid. The 'vatAmount' field is off. Expected to be €60.79 (€350.26 × (21.00 / 121.00)), got €61.00. Documentation: https://docs.mollie.com/reference/handling-errors. Request body: {"status":422,"title":"Unprocessable Entity","detail":"Line item 1 is invalid. The 'vatAmount' field is off. Expected to be €60.79 (€350.26 × (21.00 / 121.00)), got €61.00","field":"lines.1.vatAmount","_links":{"documentation":{"href":"https://docs.mollie.com/reference/handling-errors","type":"text/html"}}}. Field: lines.1.vatAmount
    2025-08-13T08:43:45+00:00 Foutopsporing ideal: Failed to create Mollie payment object for order xxxx: [2025-08-13T08:43:45+0000] Error executing API call (422: Unprocessable Entity): Line item 1 is invalid. The 'vatAmount' field is off. Expected to be €60.79 (€350.26 × (21.00 / 121.00)), got €61.00. Documentation: https://docs.mollie.com/reference/handling-errors. Request body: {"status":422,"title":"Unprocessable Entity","detail":"Line item 1 is invalid. The 'vatAmount' field is off. Expected to be €60.79 (€350.26 × (21.00 / 121.00)), got €61.00","field":"lines.1.vatAmount","_links":{"documentation":{"href":"https://docs.mollie.com/reference/handling-errors","type":"text/html"}}}. Field: lines.1.vatAmount

    As you can see, somehow €350 gets converted to €350,26. I’ve repeated this step in a clean WordPress and WooCommerce environment and got the same problem.

    Thread Starter Ferhat1986

    (@ferhat1986)

    It seems like there is a bigger issue with setting the decimals to 0 in WooCommerce and the problem isn’t really in the Mollie plugin but rather in the way WooCommerce handles decimals with this setting.

    Instead of using the WooCommerce setting “Number of decimals” and setting it to 0, i used a WooCommerce filter to trim the zeros:

    add_filter( 'woocommerce_price_trim_zeros', '__return_true' );

    This way the user will only see decimals in VAT, shipping costs and at the total order price. In my case “Cart” & “Checkout” pages.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Product prices without decimals’ is closed to new replies.