Payment mode Charge in Klarna Checkout

Hi!

I would like to set payment mode to charge in Klarna Checkout, to charge money when order is placed. I did this in KlarnaPaymentWidgetController.cs by setting
checkoutFlowInfo.ExecutePaymentMode = ExecutePaymentMode.Charge;

The version of add-on I was using before, Litium.AddOns.Klarna 4.7.102, had a bug: KlarnaPaymentArgsCreator.CreatePaymentArgs would always set klarnaPaymentArgs.PaymentMode to Reserve. To avoid this I updated to latest version of add-on 4.7.103, and then I also had to make some changes in KlarnaPaymentWidgetConfigV3.cs, to use CheckoutOrder instead of CheckoutOrderData.
(Couldn’t find this in any accelerator, but I might be wrong, does latest version of Klarna Checkout work with any version of MVC Accelerator?)

Now klarnaPaymentArgs.PaymentMode is Charge when i debug but the payment in Litium is still Reserved and in Klarna it is Uncaptured.
Can you help me out? Should I look for something in the logs?

Litium version: 5.6.6

Accelerator is not updated in the release package to use the latest version of Klarna Payment Add-On and you have upgrade instructions here.

Klarna Checkout is only supporting reservation mode so it is not possible to change to get the money captured directly when order is placed.

Ok, thanks. Do you have any example of how to charge from code in Klarna v3?
I found this question about Klarna v2 but no answer:

There’s an example in the PaymentService from the Headless API add-on.
https://docs.litium.com/add-ons/connectors/litium-headless-api-v7-2-100-for-litium-7

public PaymentInfoResult Capture(string externalOrderId, string paymentReferenceId)
{          
	var order = ModuleECommerce.Instance.Orders[externalOrderId, _adminToken];
	if (order == null)
		throw new DoesNotExistException($"order {externalOrderId} not found.");

	var payment = order.PaymentInfo.FirstOrDefault(x => x.ReferenceID == paymentReferenceId);
	if (payment == null)
		throw new DoesNotExistException($"Payment {paymentReferenceId} is not found in order {externalOrderId}.");

	var existingMessage = payment.ExternalMessage;
	var paymentResult = payment.PaymentProvider.CompletePayment(new CapturePaymentArgs(), _adminToken);

	var result = new PaymentInfoResult(externalOrderId, paymentReferenceId, paymentResult?.Success ?? false);
	payment.PopulatePaymentInfoResult(result, existingMessage);

	return result;
}

Ok, I will look into it, thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.