Klarna Docs - Payments in a nutshell.

Payments in a nutshell.

The end-to-end process to make a payment with Klarna involves three main steps:

  1. Initiate a payment creates a session that identifies the purchase towards Klarna.
  2. Check out displays Klarna payments methods and authorizes the purchase.
  3. Create an order uses the authorized payment from the previous step and creates an order.

The payment process has slight variations according to each scenario: one-time or recurring payments. The following sections present a high-level description of the payment process in each scenario.

The payment process starts when you create a session towards Klarna. With an active session, you are able to show our payment methods in your checkout.

This session identifies the payment and is unique for the order life cycle. It also dictates which payment methods are available, depending on the purchase country and the cart's amount.

Creating a session takes place in the server side. You have to send a request to the Klarna payments API. As a response, you get a client_token (JSON Web Token), useful for the following step.

You need to specify in the API request that the created session is for a one-time payment. The intent parameter should contain the values that are valid for this scenario.

You need to specify in the API request that the created session is for a recurring payment. The intent parameter should contain the values that are valid for this scenario.

For more technical details, see Step 1: Initiate a payment.

When you create the purchase session, your customer can see the Klarna payments methods in your checkout and go ahead with the purchase.

This step consists of two actions:

  1. displaying the Klarna widget
  2. authorizing the purchase.

Displaying the Klarna widget.

The widget displays the Klarna payments methods that are available for the current session. You have to load the widget along with other payment methods you offer in your checkout.

Displaying the widget takes place in the client side. You need to make a request using Klarna's Javascript SDK and pass the client_token from the previous step.

Authorizing the purchase.

When your customer selects one of our payment methods, you have to request authorization from our side before going ahead. During this step, a risk and fraud assessment takes place on the specific purchase and customer. We use the order and customer information, make an assessment, and decide whether or not to accept this purchase.

Authorizing the purchase takes place in the client side. You need to make a request using the Klarna's Javascript SDK. As a response, you receive an authorization_token, useful for the following step.

In this scenario, the widget displays all the available payment methods authorized for this session.

In this scenario, the widget displays the available payment methods specific for recurrent payments (card, invoice, and direct debit).

For more technical details, see Step 2: Check out.

To continue with the purchase, you have to create an order in Klarna's system.

This step takes place in the server side through the Klarna payments API.

For one-time payments, you send an API request, including the authorization_token from the previous step and a URL pointing to the confirmation page for your customer. This request creates an order in Klarna’s system. Once you create an order, the payment session is closed.

Creating an order for recurring payments comprises two sub-steps:

  1. generating a customer token
  2. placing the order.

Generating customer_token

Generate a customer_token to use it any time you need to place an order. The customer_token identifies your customer and their preferred payment method. To generate the customer_token, you send an API request, including the authorization_token from the previous step.

Placing the order

The customer_token allows you to create an order on behalf of your customer without the need for their confirmation at the moment of the payment. You can place the order anytime by sending an API request, including the customer_token and the order details.

For more technical details, see Step 3: Create an order.