Klarna
Implementing Klarna Checkout v3 as payment provider
Klarna Checkout is a service from Klarna which gathers all your payment options into one agreement. You only have one supplier, one integration, one agreement, one payout, one settlement and one customer support. Plus, Klarna assumes the customer risk, meaning you get paid even if the customer doesn't pay Klarna. Klarna Checkout is rendered through an iframe where all popular payment methods are included.
This checkout handler integrates with Klarna Checkout v3. Support for older Klarna product ended in 2020.
Note
You must select a valid combination of country and currency in order for Klarna to accept payment. See the Klarna documentation for details about currently valid combinations.
When configuring a Klarna Checkout v3 payment method you need an API username (UID) and an API password – if you don’t have these, check out the Klarna documentation on how to generate keys.
When you have the API username & password you can configure the checkout handler:
- Go to Settings > Areas > Commerce > Order Management > Payment and click the '+ New payment' button in the top right corner
- Go to the Provider tab and select the Klarna Checkout v3 as as payment provider
- Fill in the remaining fields. An example is provided below for guidance
For a basic configuration:
- Supply the API username (UID) and API password from Klarna
- Select a page on your solution which contains terms & conditions – the payment widget links to this page
- Select or create templates:
- The payment template is used to frame the payment form supplied by Klarna
- The confirmation template is used to frame the receipt supplied by Klarna
- The cancel template is shown if the user cancels payment at some point during the process
- The error template is shown if an error occurs, usually due to a combination of currency & country which is not supported by Klarna
In addition, you have access to the following parameters:
Parameter | What it does | Comment |
---|---|---|
Allow separate shipping addresses | Allows the customer to ship to a different shipping address than the billing address | |
Update billing info | Updates the billing address stored by Klarna | |
Update shipping info | Updates the shipping address stored by Klarna | |
Exclude shipping address | ||
Allow choice between B2C and B2B flows | Let’s the customer choose between the B2C and B2B payment flows from Klarna | Cannot be tested on playground account, only works on a live account |
Set default flow to B2B instead of B2C | Sets the default payment flow to B2B | Cannot be tested on playground account, only works on a live account |
Use Klarna receipt instead of cart module receipt | Shows the Klarna receipt instead of the standard Shopping Cart receipt | |
Test mode | Enables test mode | Use this to simulate transactions |
Sample payment data for testing can be found here and sample customer data can be found here.
Remember to test with a combination of currency & country supported by Klarna.
Templates
To handle payment in Klarna checkout, you can use our TemplateTags. The available tags are:
- KlarnaCheckout.CancelURL
- KlarnaCheckout.CheckoutSnippet
KlarnaCheckout.CancelURL
Returns the URL to the page that the payment will redirect to if the customer cancels the payment.
Razor example:
@GetString("KlarnaCheckout.CancelURL")
HTML example:
<!--@KlarnaCheckout.CancelURL-->
KlarnaCheckout.CheckoutSnippet
Returns text that defines checkout snippet to render.
Razor example:
@GetString("KlarnaCheckout.CheckoutSnippet")
HTML example:
<!--@KlarnaCheckout.CheckoutSnippet-->