Delivery

The following actions can be taken when the item is being shipped from your store.

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

Capture the full amount

Use this call when fulfillment is completed, e.g. physical products are being shipped to the customer.

Use case

You have sent the goods to the consumer and want to capture the amount for the item(s).

 

 

1. Add the order information and make the API call

'captured_amount' must be equal to or less than the order's 'remaining_authorized_amount'.
Shipping address is inherited from the order.

The capture amount can optionally be accompanied by a descriptive text and order lines for the captured items.

POST /ordermanagement/v1/orders/{order_id}/captures
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json

{
  "captured_amount": 6000,
  "description": "Shipped the full order",
  "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
    }
  ],
  "shipping_info": [
    {
      "shipping_company": "DHL",
      "shipping_method": "Home",
      "tracking_uri": "tracking-uri",
      "tracking_number": "1234567890",
      "return_tracking_number": "E-55-KL",
      "return_shipping_company": "DHL",
      "return_tracking_uri": "return-tracking-uri"
    }
  ]
}

2. Handle the response from Klarna

Klarna will respond with 201 - Created or an error message

HTTP/1.1 201 Created
Location: http://klarna/orders/{order_id}/captures/{capture_id}

Capture part of the order amount

Use this call when part of the fulfillment is completed, e.g. physical goods are being shipped to the customer.

Use case

You have sent at least part of the order to the consumer and want to capture the amount for the item(s) that have been shipped.

1. Add the order information and make the API call

'captured_amount' must be equal to or less than the order's 'remaining_authorized_amount'.
Shipping address is inherited from the order.

The capture amount can optionally be accompanied by a descriptive text and order lines for the captured items.

POST /ordermanagement/v1/orders/{order_id}/captures
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Content-Type: application/json

{
  "captured_amount": 1200,
  "description": "Shipped part of the order",
  "order_lines": [
    {
      "type": "physical",
      "reference": "123050",
      "name": "Tomatoes",
      "quantity": 2,
      "quantity_unit": "kg",
      "unit_price": 600,
      "tax_rate": 2500,
      "total_amount": 1200,
      "total_tax_amount": 200
    }
  ],
  "shipping_info": [
    {
      "shipping_company": "DHL",
      "shipping_method": "Home",
      "tracking_uri": "tracking-uri",
      "tracking_number": "1234567890",
      "return_tracking_number": "E-55-KL",
      "return_shipping_company": "DHL",
      "return_tracking_uri": "return-tracking-uri"
    }
  ]
}

2. Handle the response from Klarna

Klarna will respond with 201 - Created or an error message

HTTP/1.1 201 Created
Location: http://klarna/orders/{order_id}/captures/{capture_id}

What's next?

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