Create order
This page provides instructions on creating an order using the Klarna Checkout (KCO) API.
Authentication
Kustom uses HTTP Basic Auth for authentication. The required credentials are:
- Username: A username associated with your Kustom Merchant ID.
- Password: A unique password associated with the username. Authentication is done using Base64 encoding of
username:password
.
Important: Never share your test or live credentials.
Endpoints (URLs)
Kustom's European and North American environments have different endpoints for testing and live purchases. All requests use HTTPS. Refer to the API URLs documentation for details.
Create Order Request
Use a POST request to the appropriate test endpoint + /checkout/v3/orders
with the header content-type: application/json
.
{
"purchase_country": "SE",
"purchase_currency": "SEK",
"locale": "en-SE",
"order_amount": 50000,
"order_tax_amount": 4545,
"order_lines": [
{
"type": "physical",
"reference": "19-402-USA",
"name": "Yellow T-Shirt",
"quantity": 5,
"quantity_unit": "pcs",
"unit_price": 10000,
"tax_rate": 1000,
"total_amount": 50000,
"total_discount_amount": 0,
"total_tax_amount": 4545
}
],
"merchant_urls": {
"terms": "https://www.example.com/terms.html",
"checkout": "https://www.example.com/checkout.html?order_id={checkout.order.id}",
"confirmation": "https://www.example.com/confirmation.html?order_id={checkout.order.id}",
"push": "https://www.example.com/api/push?order_id={checkout.order.id}"
}
}
Important: The example provided is for UK (GB) and uses mock URLs. Refer to the API reference for complete details and other use cases.
Create Order Response
The response includes:
order_id
: A unique ID generated by Kustom.html_snippet
: A string to render the Kustom Checkout iframe on your page. See the next step in the integration guide for how to use this.
{
"order_id": "8cf27b55-53e8-6aba-9fb4-7c692e56ddee",
"status": "checkout_incomplete",
"purchase_country": "se",
"purchase_currency": "SEK",
"locale": "en-SE",
"billing_address": {
"country": "se"
},
"customer": {},
"shipping_address": {
"country": "se"
},
"order_amount": 50000,
"order_tax_amount": 4545,
"order_lines": [
...
],
"merchant_urls": {
...
},
"html_snippet": "<div id=\"klarna-checkout-container\".................",
"started_at": "2025-02-05T10:41:58Z",
"last_modified_at": "2025-02-05T10:41:58Z",
"options": {
"allow_separate_shipping_address": false,
"date_of_birth_mandatory": false,
"require_validate_callback_success": false
},
"external_payment_methods": [],
"external_checkouts": []
}
This guide provides basic information. Refer to the complete Kustom Checkout documentation for a comprehensive understanding of all fields, configuration options, and integration procedures.