Post-delivery

In this section, you will learn more about how to manage your orders after they have been shipped using Klarna’s order management API.

Retrieve a capture.
Add new shipping information to a capture.
Trigger a new send out of customer communication.
Refund an amount of a captured order.
Release the reamining authorization for an order.

Prerequisites

Tip: You can read more in-depth technical content on the API / SDK reference page.

Retrieve a capture

Retrieving all information related to a capture, as example shipping/billing information.

Use case

You need to view what information is related to a shipped item.

1. Retrieve the capture information from Klarna

Send in the order id and the specific capture id you want to know more about.

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

2. Handle the response from Klarna

Klarna will respond with one of the following:

Error message- something went wrong

200 - OK - The server has fulfilled the request and the capture information is returned

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
57
HTTP/1.1 200 OK
Content-Type: application/json

{
  "capture_id": "5b33ed47-79d0-4d76-99ea-4afaa7c8e552",
  "klarna_reference": "4K7Q6QF6-1",
  "captured_amount": 6000,
  "captured_at": "2017-01-10T10:31:17.973Z",
  "description": "Shipped the full order",
  "order_lines": [
    {
      "reference": "123050",
      "type": "physical",
      "quantity": 10,
      "quantity_unit": "kg",
      "name": "Tomatoes",
      "total_amount": 6000,
      "unit_price": 600,
      "total_discount_amount": 0,
      "tax_rate": 2500,
      "total_tax_amount": 1200
    }
  ],
  "refunded_amount": 0,
  "billing_address": {
    "given_name": "John",
    "family_name": "Doe",
    "title": "Mr",
    "street_address": "123 Fake St",
    "postal_code": "12345",
    "city": "New York",
    "region": "NY",
    "country": "US",
    "email": "john@doe.com",
    "phone": "123456"
  },
  "shipping_address": {
    "given_name": "John",
    "family_name": "Doe",
    "title": "Mr",
    "street_address": "123 Fake St",
    "postal_code": "12345",
    "city": "New York",
    "region": "NY",
    "country": "US",
    "email": "john@doe.com",
    "phone": "123456"
  },
  "shipping_info": [
    {
      "shipping_company": "DHL US",
      "tracking_number": "1234567890",
      "return_shipping_company": "UPS",
      "return_tracking_number": "112233445566778899"
    }
  ]
}

Add new shipping information to a capture

Shipping information can be attached to a capture, this will help you and us to keep track of orders sent to the consumer. Read more about delivery tracking.

Use case

You have made a capture of your order, now when you have sent the order you want to add the shipping details

1. Add the shipping information and make the API call

Send in the shipping details and add them to a specific capture.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
POST /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/shipping-info
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json

{
  "shipping_info": [
    {
      "shipping_company": "DHL US",
      "tracking_number": "1234567890",
      "return_shipping_company": "UPS",
      "return_tracking_number": "112233445566778899"
    }
  ]
}

2. Handle the response from Klarna

Klarna will respond with one of the following:

Error message- something went wrong

204 - No Content - The server has fulfilled the request

Note:

In upcoming versions of the API, this response will be returned instead of 201:

201 - Created - The server has fulfilled the request

Trigger a new send out of customer communication

Trigger a new send out of customer communication., typically a new invoice, for a capture.

Use case

The consumer did not receive the invoice as expected and you want to send a new invoice.

1. Make the API call and trigger a new send out

1
2
3
POST /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/trigger-send-out
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json

2. Handle the response from Klarna

Klarna will respond with one of the following:

Error message- something went wrong

204 - No Content - The server has fulfilled the request

In case of a 404 response, the response body will indicate whether the order or capture was not found

Note:

In upcoming versions of the API, this response will be returned instead of 201:

201 - Created - The server has fulfilled the request

Refund an amount of a captured order

Refund an amount of a captured order. The refunded amount will be credited to the customer. The refunded amount must not be higher than ‘captured_amount’. The refunded amount can optionally be accompanied by a descriptive text and order lines.

Use case

The consumer sends item(s) back and you need to refund the consumer with the specific amount.

1. Add new amount and make API call

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

{
  "refunded_amount": 3000,
  "description": "Refunding half the tomatoes",
  "order_lines": [
    {
      "type": "physical",
      "reference": "123050",
      "name": "Tomatoes",
      "quantity": 5,
      "quantity_unit": "kg",
      "unit_price": 600,
      "tax_rate": 2500,
      "total_amount": 3000,
      "total_tax_amount": 600
    }
  ]
}

2. Handle the response from Klarna

Klarna will respond with one of the following:

Error message- something went wrong

201 - Created - The server has fulfilled the request

Release the remaining authorization for an order

Signal that there is no intention to perform further captures.

Use case

You and the consumer are happy with the delivery and you have no need to change or update the order.

1. Get the order id and make the API call

You need the specific order id to release the remaining authorization.

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

2. Handle the response from Klarna

Klarna will respond with one of the following:

Error message- something went wrong

204 - No Content - The server has fulfilled the request

Note:

In upcoming versions of the API, this response will be returned instead of 201:

201 - Created - The server has fulfilled the request