Klarna: Different CheckoutOptions per delivery country

We need different CheckoutOptions per delivery country in our Klarna Checkout. Specifically, we need to make the date of birth aka the social security number mandatory for some countries because of distributor requirements, but do not want that for other countries.

In the accelerator, it looks like the CheckoutOptions are only sent to Klarna when the payment widget is created. It also looks like when inside the Klarna Checkout UI, only shipping option updates are sent to Litium.

I’m guessing that the easiest way to achieve different CheckoutOptions per delivery country would be to recreate the payment widget when the delivery country changes? However, I can’t find an obvious place in the accelerator/Klarna flow to do that.

There is something in the KlarnaCheckoutController which looks similar to our needs:

SetShippingOption():
...
if (!_paymentConfigv3.IsCampaignApplied(GetSavedOrder()) && model.PaymentWidget != null)
                    // if the shipping option is not validated, we need to reload the payment widget in order to re-calculate the total order
                    model.PaymentWidget = _paymentMethodViewModelBuilder.BuildWidget(model.SelectedPaymentMethod);
                }

Would doing a BuildWidget like the above (in SetShippingOption) work?

Litium version: 7.6.2 + accelerator

Yes that one rebuilds the widget when you call it and for this purpose you need to rebuild it.

So would you say KlarnaCheckoutController.SetShippingOption is the place to achieve different CheckoutOptions per delivery country, by inspecting the delivery country and rebuilding the widget as necessary?

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