Payment info on the carrier ends up with 2 order rows with the same item, and 2 delivery rows. (Should be 1 order row, and 1 delivery row)
But order total is unchanged so the widget crashes with error: {“errors”:{“amount”:[“Amount does not match sum of orderitems”]}}
Is the Payment info missing some info that gets lost when going to PayPal then cancel?
It’s working if i select Nets Easy directly without going to PayPal first.
Without looking at any code it looks like you order not are persisted after they are re-calculated. That’s the reason you have one item that is marked for deletion and one that is marked for creation.
What will happen if you persist the order after you have change the payment method?
No, you should not remove them by yourself, then you will get stale data in database.
Instead you need to do fetch the order and run the order.SetValuesFromCarrier where you adding the updated order carrier in, then the order will clean up the data that not should be used.