Place Order towards Klarna

Placing an order towards Klarna means that the Klarna Payments session will be closed and that an order will be created in Klarna's system.

Date: 11.07.2019

You finalize the order in this step via a server side call. Before you place the order, you must have received an authorization_token from the previous step .

Best Practice: The authorization_token from the previous step is valid for 60 minutes. If you attempt to place an order with this after that time has passed, it will be rejected.

Sending the place order request

When you have received the authorization_token from the authorize-call you can place the order. Among the other order details in this request, you include a URL to the confirmation page for the customer.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "GB",
    "purchase_currency": "GBP",
    "billing_address": {
        "given_name": "John",
        "family_name": "Doe",
        "email": "john@doe.com",
        "title": "Mr",
        "street_address": "13 New Burlington St",
        "street_address2": "Apt 214",
        "postal_code": "W13 3BG",
        "city": "London",
        "region": "",
        "phone": "01895808221",
        "country": "GB"
    },
    "shipping_address": {
        "given_name": "John",
        "family_name": "Doe",
        "email": "john@doe.com",
        "title": "Mr",
        "street_address": "13 New Burlington St",
        "street_address2": "Apt 214",
        "postal_code": "W13 3BG",
        "city": "London",
        "region": "",
        "phone": "01895808221",
        "country": "GB"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "DE",
    "purchase_currency": "EUR",
    "billing_address": {
        "given_name": "Omer",
        "family_name": "Heberstreit",
        "email": "omer@Heberstreit.com",
        "title": "Herr",
        "street_address": "Im Friedenstal 38",
        "postal_code": "55006",
        "city": "WestSchon Matishagenfeld",
        "region": "",
        "phone": "+491522113356",
        "country": "DE"
    },
    "shipping_address": {
        "given_name": "Omer",
        "family_name": "Heberstreit",
        "email": "omer@Heberstreit.com",
        "title": "Herr",
        "street_address": "Im Friedenstal 38",
        "postal_code": "55006",
        "city": "WestSchon Matishagenfeld",
        "region": "",
        "phone": "+491522113356",
        "country": "DE"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "AT",
    "purchase_currency": "EUR",
    "billing_address": {
        "given_name": "Edwin",
        "family_name": "Blochwitz",
        "email": "edwin@blochwitz.com",
        "title": "Herr",
        "street_address": "Paul Peters-Gasse 60b",
        "postal_code": "1733",
        "city": "WestZerlachmouth",
        "region": "OO",
        "phone": "+43 676 2600000",
        "country": "AT"
    },
    "shipping_address": {
        "given_name": "Edwin",
        "family_name": "Blochwitz",
        "email": "edwin@blochwitz.com",
        "title": "Herr",
        "street_address": "Paul Peters-Gasse 60b",
        "postal_code": "1733",
        "city": "WestZerlachmouth",
        "region": "OO",
        "phone": "+43 676 2600000",
        "country": "AT"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "NL",
    "purchase_currency": "EUR",
    "billing_address": {
        "given_name": "Sander",
        "family_name": "Dekker",
        "email": "sander@dekker.com",
        "title": "Dhr.",
        "street_address": "Boerpark 742 II",
        "postal_code": "7551 JI",
        "city": "Enschede",
        "phone": "06-14341727",
        "country": "NL"
    },
    "shipping_address": {
        "given_name": "Sander",
        "family_name": "Dekker",
        "email": "sander@dekker.com",
        "title": "Dhr.",
        "street_address": "Boerpark 742 II",
        "postal_code": "7551 JI",
        "city": "Enschede",
        "phone": "06-14341727",
        "country": "NL"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "DK",
    "purchase_currency": "DKK",
    "billing_address": {
        "given_name": "Michael",
        "family_name": "Sorensen",
        "email": "michael@sorensen.com",
        "street_address": "Nygyde 8",
        "postal_code": "2042",
        "city": "København",
        "phone": "29911076",
        "country": "DK"
    },
    "shipping_address": {
        "given_name": "Michael",
        "family_name": "Sorensen",
        "email": "michael@sorensen.com",
        "street_address": "Nygyde 8",
        "postal_code": "2042",
        "city": "København",
        "phone": "29911076",
        "country": "DK"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "NO",
    "purchase_currency": "NOK",
    "billing_address": {
        "given_name": "Marius",
        "family_name": "Huseby",
        "email": "marius@huseby.com",
        "street_address": "Hagens Gate 53",
        "postal_code": "2151",
        "city": "Oslo",
        "phone": "+45 40 123 456",
        "country": "NO"
    },
    "shipping_address": {
        "given_name": "Marius",
        "family_name": "Huseby",
        "email": "marius@huseby.com",
        "street_address": "Hagens Gate 53",
        "postal_code": "2151",
        "city": "Oslo",
        "phone": "+45 40 123 456",
        "country": "NO"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "FI",
    "purchase_currency": "EUR",
    "billing_address": {
        "given_name": "Saimi",
        "family_name": "Pennanen",
        "email": "saimi@pennanen.com",
        "street_address": "Meriluotokatu 447",
        "postal_code": "78164",
        "city": "Helsinki",
        "phone": "+358 401234567",
        "country": "FI"
    },
    "shipping_address": {
        "given_name": "Saimi",
        "family_name": "Pennanen",
        "email": "saimi@pennanen.com",
        "street_address": "Meriluotokatu 447",
        "postal_code": "78164",
        "city": "Helsinki",
        "phone": "+358 401234567",
        "country": "FI"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "SE",
    "purchase_currency": "SEK",
    "billing_address": {
        "given_name": "Håkan",
        "family_name": "Larsson",
        "email": "hakan.larsson.test@klarna.com",
        "street_address": "Lars Väg 399",
        "postal_code": "11354",
        "city": "Stockholm",
        "phone": "0765260000",
        "country": "SE"
    },
    "shipping_address": {
        "given_name": "Håkan",
        "family_name": "Larsson",
        "email": "hakan@larsson.com",
        "street_address": "Lars Väg 399",
        "postal_code": "11354",
        "city": "Stockholm",
        "phone": "0765260000",
        "country": "SE"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "SE",
    "purchase_currency": "SEK",
    "billing_address": {
        "given_name": "Roger",
        "family_name": "Schmidt",
        "email": "roger.Schmidt.test@klarna.com",
        "street_address": "Bahnhofstrasse 4a",
        "postal_code": "8001",
        "city": "Zurich",
        "phone": "0793123456",
        "country": "CH"
    },
    "shipping_address": {
        "given_name": "Roger",
        "family_name:" "Schmidt",
        "email": "roger.Schmidt.test@klarna.com",
        "street_address": "Bahnhofstrasse 4a",
        "postal_code": "8001",
        "city": "Zurich",
        "phone": "0793123456",
        "country": "CH"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

{
    "purchase_country": "US",
    "purchase_currency": "USD",
    "billing_address": {
        "given_name": "John",
        "family_name": "Doe",
        "email": "john@doe.com",
        "title": "Mr",
        "street_address": "Lombard St 10",
        "street_address2": "Apt 214",
        "postal_code": "90210",
        "city": "Beverly Hills",
        "region": "CA",
        "phone": "333444555",
        "country": "US"
    },
    "shipping_address": {
        "given_name": "John",
        "family_name": "Doe",
        "email": "john@doe.com",
        "title": "Mr",
        "street_address": "Lombard St 10",
        "street_address2": "Apt 214",
        "postal_code": "90210",
        "city": "Beverly Hills",
        "region": "CA",
        "phone": "333444555",
        "country": "US"
    },
    "order_amount": 10,
    "order_tax_amount": 0, // optional
    "order_lines": [
        {
            "type": "physical", // optional
            "reference": "19-402-USA", // optional
            "name": "Battery Power Pack",
            "quantity": 1,
            "unit_price": 10,
            "tax_rate": 0, // optional
            "total_amount": 10,
            "total_discount_amount": 0, // optional
            "total_tax_amount": 0, // optional
            "product_url": "https://www.estore.com/products/f2a8d7e34", // optional
            "image_url": "https://www.exampleobjects.com/logo.png" // optional
        }
    ],
    "merchant_urls": {
        "confirmation": "https://example.com/confirmation",
        "notification": "https://example.com/pending" // optional
    },
    "merchant_reference1": "45aa52f387871e3a210645d4", // optional
}

When the Order has been successfully placed at Klarna, you need to handle it either through the Merchant Portal or using Klarna’s Order Management API

Validation logic of the place order request

To ensure that session handling is aligned between you as a merchant and Klarna, we are validating that data shared at Place Order is aligned with any data shared in any previous calls (from create_session, to load or authorize).

If any discrepancies are found, e.g. a changed billing_address detail, the place order call fails with an error message on the specific field that failed the validation.

See details in the section Potential error codes and messages.

Handle the response

You can either get a successful response or an error. These are described below

Example successful responses

The response contains the following information

  • order_id - Used to identify the specific placed order for order management interactions, such as capturing or refunding the order.
  • redirect_url - Includes a URL which you should immediately redirect the consumer to after you receive the response. Only received if defined by the merchant in the session.
  • fraud_status- May indicate that this is a suspected fraudulent order. In the case of a successful order this is ACCEPTED.
  • authorized_payment_method- Will display the payment method that was chosen by the consumer to complete the purchase.
1
2
3
4
5
6
{
    "order_id": "3eaeb557-5e30-47f8-b840-b8d987f5945d",
    "redirect_url": "https://payments.klarna.com/redirect/...",
    "fraud_status": "ACCEPTED",
    "authorized_payment_method":"invoice"
}

Store the order_id for future reference during order fulfillment or service center management.

In order for Klarna to securely handle the data and optimize the purchase flow they need to interact with the customer’s browser as first party (not in an iframe or similar). This is achieved by ‘bouncing’ the browser on a klarna.com page before presenting the merchant confirmation page.

To do this the merchant provides the url of their confirmation page together with the rest of the order details, and Klarna will respond with a redirect url that will take the customer to the confirmation page. The merchant should send the customer browser to the redirect_url provided in the response.

Klarna will redirect the consumer back to the page you provided in the confirmation_url.

Example Error responses

There are multiple reasons that the place order call would be rejected. The most common include:

  • The order was placed outside the authorization window, and Klarna could not re-authorize it successfully.
  • The data was not matching the data provided during the authorization call.
1
2
3
4
5
6
7
  {
      "correlation_id": "6a9b1cb1-73a3-4936-a030-481ba4bb203b",
      "error_code": "ERROR_CODE",
      "error_messages": [
          "ERROR_MESSAGE"
      ]
  }

Possible error codes and messages

Error CodeError messageComment
Error Code
NOT_FOUND
Error message
Invalid authorization token
Comment
This is returned if order is placed after the authorization token has expired. Please ensure the order is placed within 60 minutes of the authorization.
Error Code
BAD_VALUE
Error message
Not matching fields: [billing_address.postal_code]
Comment
The data entered in previous calls (create_session, load and authorize) is validated at place_order, to ensure session handling is correct. This error message is returned in case a specific field has been changed from create_session to place_order, as our validation rules thus fails.
Error Code
BAD_VALUE
Error message
Not matching fields: [Incorrect number of items in the cart. Expected: 2, Actual: 3]
Comment
If the order lines are updated or anything is added after authorize, this will fail during validation. Please ensure that the cart is kept as is or do another authorize.
Error Code
REJECTED
Error message
Rejected
Comment
This is an edge case reason, but can be triggered in case the merchant is configured with being allowed to update the cart. This could be updated from the authorize to the place order in such a way that a new authorize is triggered. In this case this is rejected.

Best Practice: If a place order is failed due to an expired authorization token. You can give the consumer the option to complete the order at this point, through update the session and proceed with loading the widget again.

Placing an order after the authorization token expires

If, for some reason, more than 60 minutes passes between an authorization is made and the order is placed the original authorization_token will expire.

In this case it is recommended to attempt a new authorization towards Klarna to receive a new authorization_token. Please note that you must use the new authorization_token when attempting to place the order.

Configurations to place order

Pending orders

NOTE: This is only done in case you have added to your agreement with Klarna that you will use pending status.

Instead of immediately accepting the order, it may happen that Klarna flags this transaction for additional review. This is indicated if fraud_status: PENDING.

Read more about what to do next in our section about pending orders .

Automatically capture created orders

If you are selling digital goods or depending on the used payment method you may want the order to be captured automatically once it has been created. In order to do so, you can set auto_capture to true when when placing the order.

Note: This feature should not be used unless you have an agreement with Klarna that you should do it, as the customer experience is sub-optimal.