Pre-delivery

The following actions can be taken on an order before the item has been shipped from your store.

Update order amount.
Cancel an authorized order.
Retrieve an order.
Update billing and/or shipping address.
Update merchant references.

Prerequisites

  • You have already obtained your API credentials.
  • A purchase has been made.
  • You have retrieved and acknowledge an order as described on the Confirm purchase page.
  • The order has not been captured.

Tip: Additional pre-delivery actions can be found in the Additional actions page.

Update order amount

Update the total order amount of an order.

Note: Each update depends on approval by Klarna. Expect that the update may be rejected in some cases.

Use case

The customer has contacted you to change or remove a product from the order and you need to update the total order amount.

Increasing the order amount is not allowed for all payment methods, read this blog post for details on when it is allowed. Please note that you will override and replace the original order amount as well as any possible order lines you might have sent with the order.

1. Update the order information and make the API call

The updated amount can optionally be accompanied by a descriptive text and new order lines. Supplied order lines will replace the existing order lines. If no order lines are supplied in the call, the existing order lines will be deleted.

We suggest that you always send updated order lines to increase the customer experience. These can later be used to visualize what the customer bought when Klarna sends settlement details to the customer.

The updated order_amount must not be negative, nor less than current captured_amount.

Currency is inferred from the original order.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PATCH /ordermanagement/v1/orders/{order_id}/authorization
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json

{
  "order_amount": 6000,
  "description": "",
  "order_lines": [
    {
      "type": "physical",
      "reference": "123050",
      "name": "Tomatoes",
      "quantity": 10,
      "quantity_unit": "kg",
      "unit_price": 600,
      "tax_rate": 2500,
      "total_amount": 6000,
      "total_tax_amount": 1200
    }
  ]
}

2. Handle the response from Klarna

Klarna will respond with 204 - The server has fulfilled the request or an error message

1
HTTP/1.1 204 No Content

Cancel an authorized order

For a cancellation to be successful, there must be no captures on the order. The authorized amount will be released and no further updates to the order w ill be allowed. Please note that a cancelled order cannot be reopened.

Use case

The customer has decided not to proceed with the purchase and wants to cancel the order before shipping the product.

1. Use the order id and make the API call

1
2
3
POST /ordermanagement/v1/orders/{order_id}/cancel
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json

2. Handle the response from Klarna

Klarna will respond with 204 - The server has fulfilled the request or an error message

1
HTTP/1.1 204 No Content

Retrieve an order

Get the current state of an order.

Use case

When you want to view the entire order information and its captures. This will give you information of the current content and state of the order.

1. Use the order id and make the API call

1
2
GET /ordermanagement/v1/orders/{order_id}
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

2. Handle the response from Klarna

Content-Type: application/json

Klarna will respond with 200 - The order is returned or an error message

1
2
3
4
HTTP/1.1 200 OK
Content-Type: application/json

{}

Update billing and/or shipping address

Update billing and/or shipping address for an order. Please note that doing so the order will be subject to customer credit check.

Use case

The customer needs to change his/her billing and/or shipping address.

1. Update the billing and/or shipping information and make the API call

Fields can be updated independently. To clear a field, set its value to “” (empty string). Mandatory fields can not be cleared.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
PATCH /ordermanagement/v1/orders/{order_id}/customer-details
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json

{
  "shipping_address": {
    "street_address": "123 Fake St",
    "postal_code": "12345",
    "city": "New York",
    "region": "NY",
    "country": "US"
  },
  "billing_address": {
    "street_address": "123 Fake St",
    "postal_code": "12345",
    "city": "New York",
    "region": "NY",
    "country": "US"
  }
}

2. Handle the response from Klarna

Klarna will respond with 204 - The server has fulfilled the request or an error message

1
HTTP/1.1 204 No Content

Update merchant references

Update your merchant specific reference information (your internal order ID). This call will update your reference number on an order.

Use case

You want to use your own order ID on the Klarna order.

1. Update the merchant references and make the API call

Update one or both merchant references. To clear a reference, set its value to “” (empty string).

1
2
3
4
5
6
7
8
PATCH /ordermanagement/v1/orders/{order_id}/merchant-references
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json

{
    "merchant_reference1": "15632423",
    "merchant_reference2": "special order"
}

2. Handle the response from Klarna

Klarna will respond with 204 - The server has fulfilled the request or an error message

1
HTTP/1.1 204 No Content

What’s next?

You have now implemented all the features you need to handle your pre-delivery process, you can now continue to implement the delivery calls.