We have a strange problem.
We are using KlarnaCheckout and it works like this that the cart is calculated with shipping and discount before the amount is sent to Klarna. That works just fine and the correct amount is calculated and the order is sent to Klarna.Klarna then sends an order push when the order is ok at their part and when we get this push, we take the cart and creates a purchase order from it using SaveAsPurchaseOrder();
And here we sometimes have a problem that the shipping or discount is left out, so the amount on the purchase order differs from the amount in Klarna and the amount in the cart. Very strange! It doesn't happen very often but from time to time.
Has anyone had this problem?
Sounds like some sort of context problem when you get the order push from Klarna. Either the market is off, so the shipping discount no longer applies, or something in the discount is depending on the customer (some visitor group?). Seeing as it is server to server, you don't have the same web context as you have when the customer sees the cart on your site.
So start checking if the market is correct in the callback. And if you have visitor groups, you'll need to build the context for that :)