Hi, I’m a bit new in gift cards implementation as well as Litium-Klarna and I am currently trying to implement gift card support using this resource: Paying with a gift card
I have added the needed functions here in our own implementation of PlaceOrder. The requirements is properly executed as stated in the document how ever when ExecutePayment is called, I get an exception:
Payment info (XXXX-XXXX-XXXX-XXXX) has already been changed in the database. Get a new copy of the object and submit your changes again.
This is somewhere when trying to set the payment status, specifically PaymentInfo.SetPaymentStatus(1, token); in code.
I’m a bit stuck and am unsure how to resolve this. I think in order to resolve this is I need to update the PaymentInfo which came from PaymentProviderBase but I’m not sure how to do so. I am currently trying to find a way to do this.
Thanks for the reply! This code is somewhere right inside our implementation of ExecutePayment.
I was able to fix the problem. I was using a different instance of PaymentInfo instead of the one that I have updated.
I have a follow up question though. I am currently having some exception below. I believe that this has something to do with how I setup the PaymentInfoCarriers. Should I be updating the order lines first with type gift_card and recalculate everything before applying the PerpareGiftCardPayment? I’m thinking this is what it means by the statement below:
Litium.Foundation.Modules.ECommerce.Plugins.Payments.PaymentProviderException: 'Cannot set payment correctly for order with external id XXXXXX in Litium because Litium order GrandTotal (10000 cents) does not match with the reserved amount at Klarna (20000 cents), Klarna KCO Id = XXXX-XXXX-XXXX-XXXX.'
You have to recalculate everything before you send the order to the payment checkout. The amount that you have in Litium and the amount that you are sending to payment checkout have to match.
You have the checkout implementation for Klarna Checkout in the accelerator.