We have implemented klarnacheckout V3 with a external paymentmethod (Vipps)
So far some good the problem starts when the user is redirected to vipps and decides to cancel the order.
When we return we have some problems that needs to be solved.
Current selected payment method on the order is not Vipps even if that payment method isn’t connected to the channel. That resultet in an error on the checkout so we try to reset the paymentmethod to default paymentmethod but that fails with error "{“Cannot create a new KCO order because there exists already an order in Litium with external id LS100333.”}
Yes there is a order with that ordernumber and it is cancelled since the user selected to abort the payment in vipps.
What do one need to do to get a new ordernumber for the order that doesnt already exist i klarna?
To simplify the question. Are there anyone that have implemented external payment methods with klarna checkout V3?
Litium exemple code have example for this using DirectPay payment method but since that isnt a real paymentprovider the executepayment always is successful and it doesnt look that there are anything implemented in the checkout to handle the klarna order if the external payment goes wrong or fails.
For when i have forgotten this… Default implementation of klarna checkout doesnt handle cancel for external payment. Note also that when redirected from klarna the payment method in the cart is set not your “external payment method” so you might need to change the allowed payment methods validation depending on you implementation or change so that checkout doesnt display all payment methods connected to a channel.
To handle cancel of externalpayment method one need to update checkoutcontroller “ActionResult HandleCancelResponse” with
code to set set paymentmethod to klarna checkout in cart and set externalOrderId in cart to null or default checkout will load after cancel i external payment method and if you try to change paymentmehod to klarna checkout the checkout will not load since order already exist with same externalordernumber.