Last updated

Capture and track orders


This page details API calls for capturing orders and adding shipping information for tracking purposes. Each call includes a description, technical details, and sample requests and responses.

Capture the full order amount

Use the Order management API to fully capture an order. When you fulfill an order, capture the total amount using this API call. This triggers the payment to your bank account.

The following sequence diagram illustrates the process:

MERCHANTKUSTOMProvide the capture amount (full or partial)alt[SUCCESSFUL][ERROR]POST /ordermanagement/v1/orders/{order_id}/captures1201: Created includes capture_id, location2403: correlation_id, error_code, error_message3MERCHANTKUSTOM

To capture the full order amount:

  • Header:

    • Klarna-Idempotency-Key: A unique header to ensure idempotency. Recommended to be a UUID v4.
  • Body:

    • captured_amount: The total order amount to be captured (required). Must match the order_amount from the order creation.
    • reference: (Optional) Internal reference for the capture.
    • description: (Optional) Description of the capture for the customer.
    • order_lines: (Optional) Details associated with the capture. Recommended for Klarna app display.
    • shipping_info: (Optional) Shipping details (company, tracking number). Required for physical goods.

Example Request (JSON):

{
  "captured_amount": 6000,
  "reference": "c9a94cf1-7126-4f55-92fa-4d34f416ed7f",
  "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 US",
      "tracking_number": "1234567890",
      "return_shipping_company": "UPS",
      "return_tracking_number": "112233445566778899"
    }
  ]
}

Success Response: A 201 Created response with capture_id and location headers.

Error Response: An error response with correlation_id, error_code, and error_messages if the request fails.

Capture part of the order amount

Use the same endpoint for partial captures. Capture the amount for the shipped items.

Request details similar to full capture.

Check the details of a capture

Get details of a capture using a GET request.

Endpoint: /ordermanagement/v1/orders/{order_id}/captures/{capture_id}

Success Response: A JSON object containing capture details.

Error Response: An error response if the request fails.

Add shipping information to a capture

Add shipping information to a captured order via a POST request.

Endpoint: /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/shipping-info

Required parameters:

  • shipping_info: An array of shipping objects containing company, tracking number, and tracking URI.

Example Request (JSON):

{
  "shipping_info": [
    {
      "return_shipping_company": "DHL US",
      "return_tracking_number": "93456415674545679888",
      "return_tracking_uri": "http://shipping.example/findmypackage?93456415674545679888",
      "shipping_company": "DHL US",
      "shipping_method": "Home",
      "tracking_number": "63456415674545679874",
      "tracking_uri": "http://shipping.example/findmypackage?63456415674545679874"
    }
  ]
}

Success Response: A 204 No content response.

Error Response: An error response if the request fails.

Send customer communications

Trigger customer communication (e.g., email) about order changes.

Endpoint: /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/trigger-send-out

No request body is needed.

Success Response: A 204 No content response.

Error Response: An error response if the request fails.