krokedil / klarna-checkout-for-woocommerce

Klarna Checkout for WooCommerce plugin
15 stars 23 forks source link

Create order and capture order does not match amount CAPTURE_NOT_ALLOWED #585

Closed webartistse closed 2 months ago

webartistse commented 2 months ago

We having a problem while capturing payment. The create order request and capture request does not match.

Capture response: { "error_code": "CAPTURE_NOT_ALLOWED", "error_messages": [ "Captured amount is higher than the remaining authorized amount. Capture not possible." ], "correlation_id": "XXX" }

I found that prices are calculated wrong when a shipping fee is used. Create order llok like this: { "reference": "flat_rate:2", "name": "DHL", "quantity": 1, "unit_price": 9880, "tax_rate": 2506, "total_amount": 9880, "total_discount_amount": 0, "total_tax_amount": 1980, "type": "shipping_fee" }

Capture look this is: { "reference": "flat_rate:2", "type": "shipping_fee", "name": "DHL", "quantity": 1, "unit_price": 9900, "tax_rate": 2500, "total_amount": 9900, "total_discount_amount": 0, "total_tax_amount": 2000 }

My settings are: https://imgur.com/a/ybE320P Price for shipping should be 99 sek.

What could be the problem with this miscalculation?

webartistse commented 2 months ago

It turns out it is a configuration problem. More info here: https://krokedil.no/dont-display-prices-with-0-decimals-in-woocommerce/