Start a new topic

Klarna snippet on confirmation page

Hi,


I have resumed working on my Klarna payment method. My problem now is that Klarna expect a "snippet" on the confirmation page. Very similar to the snippet serving as a payment form.

I get the snippet in the PostProccessPayment method, and want it to end up as a liquid accessable property on the "Thanks" page.

As far as I can see, the proper way of doing so would be to add a "htmlConfirmationSnippet" property to the PostProcessPaymentResult class and the PaymentIn class. Add necessary modifications to the converters. Modify the models and converters for liquid.

This is probably not a good idea for me to do, but maybe it can be added as a feature request.

My next thought was to jam the snippet into a dynamic property on the payment, but this idea crashed when I realized I can't reach that property on the liquid template "thanks.liquid".


Anyone got any ideas on how to solve this?

I try to not think of the order note property even if that would probably work, but would be oh so dirty to do.

:Sigve


If there is an availability to get Klarna "snippet" via java script on "thanks" page. You probably can look how to do it  here https://developers.klarna.com/en/se/kco-v2/checkout/javascript-apiWe use this approach in other projects.(but cannot provide full snippet js because need preparing it first). And then you can generate this "snippet" script on fly in "Thanks" template by using payment information from placed order.



Klarna said firmly no to getting the snippet by javascript. I may have misunderstood you, and you meant use a javascript to get it from somewhere where it was genrerated safely.


I solved it for now. Not a beautiful solution, but it works:

I created a dynamic prop for payments, and stored the snippet there. In the "thanks" page controller, I get the dynamic prop and do a Response.Write(prop value). In the "thanks" view, I use javascript to detach the element, and append it to a proper location on the page.


:Sigve

Login or Signup to post a comment