v1

latestOpenAPI 3.0.02026-07-1462248.4 KB
orders

Create a new order

Use this API call to create a new order. 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.<br/>When you have received the authorization_token for a successful authorization you can place the order. Among the other order details in this request, you include a URL to the confirmation page for the customer.<br/>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. Read more on Create a new order.

post/payments/v1/authorizations/{authorizationToken}/order

Path parameters

authorizationTokenstring required

Request body

authorization_tokenstring

Authorization token.

auto_captureboolean

Allow merchant to trigger auto capturing.

custom_payment_method_idsstring[]

Promo codes - The array could be used to define which of the configured payment options within a payment category (pay_later, pay_over_time, etc.) should be shown for this purchase. Discuss with the delivery manager to know about the promo codes that will be configured for your account. The feature could also be used to provide promotional offers to specific customers (eg: 0% financing). Please be informed that the usage of this feature can have commercial implications.

localestring

Used to define the language and region of the customer. The locale follows the format of (RFC 1766)[https://datatracker.ietf.org/doc/rfc1766/], meaning its value consists of language-country. The following values are applicable:

AT: "de-AT", "de-DE", "en-DE" BE: "be-BE", "nl-BE", "fr-BE", "en-BE" CH: "it-CH", "de-CH", "fr-CH", "en-CH" DE: "de-DE", "de-AT", "en-DE" DK: "da-DK", "en-DK" ES: "es-ES", "ca-ES", "en-ES" FI: "fi-FI", "sv-FI", "en-FI" GB: "en-GB" IT: "it-IT", "en-IT" NL: "nl-NL", "en-NL" NO: "nb-NO", "en-NO" PL: "pl-PL", "en-PL" SE: "sv-SE", "en-SE" US: "en-US".

merchant_datastring

Pass through field to send any information about the order to be used later for reference while retrieving the order details (max 6000 characters)

merchant_reference1string

Used for storing merchant's internal order number or other reference.

merchant_reference2string

Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters).

order_amountinteger required

Total amount of the order including tax and any available discounts. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.

order_tax_amountinteger

Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.

purchase_countrystring required

The purchase country of the customer. The billing country always overrides purchase country if the values are different. Formatted according to ISO 3166 alpha-2 standard, e.g. GB, SE, DE, US, etc.

purchase_currencystring required

The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc.

status'complete' | 'incomplete'

The current status of the session. Possible values: 'complete', 'incomplete' where 'complete' is set when the order has been placed.

Example request

{
  "billing_address": {
    "attention": "Attn",
    "city": "London",
    "country": "GB",
    "email": "test.sam@test.com",
    "family_name": "Andersson",
    "given_name": "Adam",
    "phone": "+44795465131",
    "postal_code": "W1G 0PW",
    "region": "OH",
    "street_address": "33 Cavendish Square",
    "street_address2": "Floor 22 / Flat 2",
    "title": "Mr."
  },
  "customer": {
    "date_of_birth": "1978-12-31",
    "gender": "male",
    "title": "Mr.",
    "type": "organization"
  },
  "locale": "en-GB",
  "merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
  "merchant_reference1": "ON4711",
  "merchant_reference2": "hdt53h-zdgg6-hdaff2",
  "merchant_urls": {
    "authorization": "https://www.example-url.com/authorization",
    "confirmation": "https://www.example-url.com/confirmation",
    "notification": "https://www.example-url.com/notification",
    "push": "https://www.example-url.com/push"
  },
  "order_amount": 2500,
  "order_lines": [
    {
      "image_url": "https://www.exampleobjects.com/logo.png",
      "merchant_data": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
      "name": "Running shoe",
      "product_identifiers": {
        "brand": "shoe-brand",
        "category_path": "Shoes > Running",
        "color": "white",
        "global_trade_item_number": "4912345678904",
        "manufacturer_part_number": "AD6654412-334.22",
        "size": "small"
      },
      "product_url": "https://.../AD6654412.html",
      "quantity": 1,
      "quantity_unit": "pcs",
      "reference": "AD6654412",
      "tax_rate": 1900,
      "total_amount": 2500,
      "total_discount_amount": 500,
      "total_tax_amount": 475,
      "type": "physical",
      "unit_price": 2500
    }
  ],
  "order_tax_amount": 475,
  "payment_method_categories": [
    {
      "asset_urls": {
        "descriptive": "https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg",
        "standard": "https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg"
      },
      "identifier": "klarna",
      "name": "Pay with Klarna"
    }
  ],
  "purchase_country": "GB",
  "purchase_currency": "GBP",
  "shipping_address": {
    "attention": "Attn",
    "city": "London",
    "country": "GB",
    "email": "test.sam@test.com",
    "family_name": "Andersson",
    "given_name": "Adam",
    "phone": "+44795465131",
    "postal_code": "W1G 0PW",
    "region": "OH",
    "street_address": "33 Cavendish Square",
    "street_address2": "Floor 22 / Flat 2",
    "title": "Mr."
  },
  "status": "complete"
}

Response

Order was successfully created.

fraud_statusstring

Fraud status for the order. Either ACCEPTED or PENDING. If ACCEPTED, the order could be captured. If PENDING, please wait till you receive the notification from Klarna in the notification URL that the order has been approved. You can find additional information here.

order_idstring required

Unique order ID of the transaction. This ID will be used for all order management processes.

redirect_urlstring

URL to redirect the customer to after placing the order. This is a Klarna URL to which the merchant should redirect the customer to. Klarna will place a cookie in the customer’s browser (if redirected) and redirect the customer back to the confirmation URL provided by the merchant. This is not a mandatory step but a recommended one to improve the returning customer’s experience. It is a spontaneous step and does not harm the customer’s experience.

Example response

{
  "redirect_url": "https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect"
}