Klarna Checkout

Setting up the payment method:


  • Go to "/edit" and navigate to the Payment tab in the Shop module
  • Press the "Add payment method" button
  • Choose "Creditcard payment method" as the type
  • To make the Payment Method a "Klarna Checkout Payment Method" navigate to the "Payment method" tab
  • below you will find a property called Payment provider, choose the provider with the name:




  • The property called "Type of payment" should be set as "Two phase"
  • Remember to check the "Test mode enabled" if you are using test credentials from Klarna
  • lastly you will need to add your API credentials from Klarna. The API credentials from Klarna comes in the form of a username and a password. Add these together, seperated like this "{username}:{password}". The token should be placed under the "Credit Card Payment Method" tab and at the "Token" property. The token should look something like this: "PK123_9l0Cjo5i0KWMb2TB:8a3or1GVUD0xR4AV", where the username would be: "PK123_9l0Cjo5i0KWMb2TB" and the password would be: "8a3or1GVUD0xR4AV".


Creating a payment:


  • Step 1: Fetch the order and calculate the amounts


Order order =  WAFShopHelper.GetCurrentOrder(Request, Response);


  • Step 2: Create a session.
    Since klarna requires a url for the Terms and conditions this should be provided in order to create a session with Klarna Checkout.


PaymentMethod paymentMethod = order.PaymentMethod.Get();
var paymentMethodData = new PaymentMethodData();

paymentMethodData.PaymentData.Add("Terms", "https://www.example.com");

paymentMethodData.PaymentMethodNodeId = paymentMethod.NodeId;

PaymentActionResult paymentActionResult = paymentMethod.GetPaymentProvider().CreateSession(paymentMethodData);


  • Step 3: Fetch the html_snippet.
    After the session is created you will need to display the Klarna Checkout html.
    The html is returned in the CreateSession method and should be added to the page


//Add this string to your page
string html_string = paymentActionResult.PostValues.Get("html_snippet");


  • Step 4: Payment process:
    After the "html_string" is loaded, Klarna Checkout handles the rest of the payment process. When Klarna Checkout finishes, the user is redirected to your "OrderRecived" page. This page can be changed under the "Settings" tab in the Shop module. The order reference (QueryString: "orderRef", Property: WAF.Engine.Content.Native.Order.OrderReference) is also provided in the QueryString to the "OrderRecived" page.



Merchant Urls:
Klarna also has the option of adding endpoints related to the payment process. If you would like to take advantage of any of these endpoints you could add the urls before you create the session, the same way that the temrs url is added.