Download OpenAPI specification:Download
The payments API is used to create a session to offer Klarna's payment methods as part of your checkout. As soon as the purchase is completed the order should be read and handled using the Order Management API
.
Note: Examples provided in this section includes full payloads, including all supported fields , required and optionals. In order to implement a best in class request we recommend you don't include customer details when initiating a payment session. Refer to Initiate a payment section for further details.
Read more on Klarna payments.
Use this API call to create a Klarna Payments session.
When a session is created you will receive the available payment_method_categories
for the session, a session_id
and a client_token
. The session_id
can be used to read or update the session using the REST API. The client_token
should be passed to the browser.
Read more on Create a new payment session.
session_request
acquiring_channel | string The acquiring channel in which the session takes place. Ecommerce is default unless specified. Any other values should be defined in the agreement. |
object (attachment) | |
object (address) | |
custom_payment_method_ids | Array of strings 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. |
object (customer) | |
design | string Design package to use in the session. This can only by used if a custom design has been implemented for Klarna Payments and agreed upon in the agreement. It might have a financial impact. Delivery manager will provide the value for the parameter. |
locale | string^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$ Used to define the language and region of the customer. The locale follows the format of RFC 1766, meaning its value consists of language-country. Default value is "en-US". Read more on Supported Locals and Currencies. |
merchant_data | string [ 0 .. 6000 ] characters 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_reference1 | string [ 0 .. 255 ] characters Used for storing merchant's internal order number or other reference. |
merchant_reference2 | string [ 0 .. 255 ] characters Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters). |
object (merchant_urls) | |
object (options) | |
order_amount required | integer <int64> >= 0 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. |
required | Array of objects (order_line) [ 1 .. 1000 ] items The array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order. |
order_tax_amount | integer <int64> >= 0 Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500. |
purchase_country required | string^[A-Za-z]{2,2}$ 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_currency required | string^[A-Za-z]{3,3}$ The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc. |
object (address) | |
intent | string Intent for the session. The field is designed to let partners inform Klarna of the purpose of the customer’s session. |
successful operation
We were unable to create a session with the provided data. Some field constraint was violated.
You were not authorized to execute this operation.
{- "acquiring_channel": "ECOMMERCE",
- "attachment": {
- "body": "{\"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\"}]}",
- "content_type": "application/vnd.klarna.internal.emd-v2+json"
}, - "billing_address": {
- "attention": "Attn",
- "city": "London",
- "country": "GB",
- "email": "test.sam@test.com",
- "family_name": "Andersson",
- "given_name": "Adam",
- "organization_name": "string",
- "phone": "+44795465131",
- "postal_code": "W1G 0PW",
- "region": "OH",
- "street_address": "33 Cavendish Square",
- "street_address2": "Floor 22 / Flat 2",
- "title": "Mr."
}, - "custom_payment_method_ids": [
- "string"
], - "customer": {
- "date_of_birth": "1978-12-31",
- "gender": "male",
- "last_four_ssn": "string",
- "national_identification_number": "string",
- "organization_entity_type": "LIMITED_COMPANY",
- "organization_registration_id": "string",
- "title": "Mr.",
- "type": "organization",
- "vat_id": "string"
}, - "design": "string",
- "locale": "en-US",
- "merchant_data": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
- "merchant_reference1": "ON4711",
- "merchant_reference2": "hdt53h-zdgg6-hdaff2",
- "merchant_urls": {
}, - "options": {
- "color_border": "#FF9900",
- "color_border_selected": "#FF9900",
- "color_details": "#FF9900",
- "color_text": "#FF9900",
- "radius_border": "5px"
}, - "order_amount": 2000,
- "order_lines": [
- {
- "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",
- "global_trade_item_number": "4912345678904",
- "manufacturer_part_number": "AD6654412-334.22",
- "color": "white",
- "size": "small"
}, - "quantity": 1,
- "quantity_unit": "pcs",
- "reference": "AD6654412",
- "tax_rate": 2000,
- "total_amount": 2000,
- "total_discount_amount": 500,
- "total_tax_amount": 333,
- "type": "physical",
- "unit_price": 2500,
- "subscription": {
- "name": "string",
- "interval": "DAY",
- "interval_count": 1
}
}
], - "order_tax_amount": 333,
- "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",
- "organization_name": "string",
- "phone": "+44795465131",
- "postal_code": "W1G 0PW",
- "region": "OH",
- "street_address": "33 Cavendish Square",
- "street_address2": "Floor 22 / Flat 2",
- "title": "Mr."
}, - "intent": "buy"
}
{- "client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
- "payment_method_categories": [
- {
- "asset_urls": {
}, - "identifier": "klarna",
- "name": "Pay with Klarna"
}
], - "session_id": "0b1d9815-165e-42e2-8867-35bc03789e00"
}
Use this API call to update a Klarna Payments session with new details, in case something in the order has changed and the checkout has been reloaded. Including if the consumer adds a new item to the cart or if consumer details are updated. Read more on Update an existing payment session.
session_request
acquiring_channel | string The acquiring channel in which the session takes place. Ecommerce is default unless specified. Any other values should be defined in the agreement. |
object (attachment) | |
object (address) | |
custom_payment_method_ids | Array of strings 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. |
object (customer) | |
design | string Design package to use in the session. This can only by used if a custom design has been implemented for Klarna Payments and agreed upon in the agreement. It might have a financial impact. Delivery manager will provide the value for the parameter. |
locale | string^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$ Used to define the language and region of the customer. The locale follows the format of RFC 1766, meaning its value consists of language-country. Read more on Supported Locals and Currencies. |
merchant_data | string [ 0 .. 6000 ] characters 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_reference1 | string [ 0 .. 255 ] characters Used for storing merchant's internal order number or other reference. |
merchant_reference2 | string [ 0 .. 255 ] characters Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters). |
object (merchant_urls) | |
object (options) | |
order_amount | integer <int64> >= 0 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. |
Array of objects (order_line) [ 1 .. 1000 ] items The array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order. | |
order_tax_amount | integer <int64> >= 0 Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500. |
purchase_country | string^[A-Za-z]{2,2}$ 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_currency | string^[A-Za-z]{3,3}$ The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc. |
object (address) | |
intent | string Intent for the session. The field is designed to let partners inform Klarna of the purpose of the customer’s session. |
The session was updated successfully.
We were unable to update the session with the provided data. Some field constraint was violated.
You were not authorized to execute this operation.
The session does not exist.
{- "acquiring_channel": "ECOMMERCE",
- "attachment": {
- "body": "{\"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\"}]}",
- "content_type": "application/vnd.klarna.internal.emd-v2+json"
}, - "billing_address": {
- "attention": "Attn",
- "city": "London",
- "country": "GB",
- "email": "test.sam@test.com",
- "family_name": "Andersson",
- "given_name": "Adam",
- "organization_name": "string",
- "phone": "+44795465131",
- "postal_code": "W1G 0PW",
- "region": "OH",
- "street_address": "33 Cavendish Square",
- "street_address2": "Floor 22 / Flat 2",
- "title": "Mr."
}, - "custom_payment_method_ids": [
- "string"
], - "customer": {
- "date_of_birth": "1978-12-31",
- "gender": "male",
- "last_four_ssn": "string",
- "national_identification_number": "string",
- "organization_entity_type": "LIMITED_COMPANY",
- "organization_registration_id": "string",
- "title": "Mr.",
- "type": "organization",
- "vat_id": "string"
}, - "design": "string",
- "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": {
}, - "options": {
- "color_border": "#FF9900",
- "color_border_selected": "#FF9900",
- "color_details": "#FF9900",
- "color_text": "#FF9900",
- "radius_border": "5px"
}, - "order_amount": 2000,
- "order_lines": [
- {
- "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",
- "global_trade_item_number": "4912345678904",
- "manufacturer_part_number": "AD6654412-334.22",
- "color": "white",
- "size": "small"
}, - "quantity": 1,
- "quantity_unit": "pcs",
- "reference": "AD6654412",
- "tax_rate": 2000,
- "total_amount": 2000,
- "total_discount_amount": 500,
- "total_tax_amount": 333,
- "type": "physical",
- "unit_price": 2500,
- "subscription": {
- "name": "string",
- "interval": "DAY",
- "interval_count": 1
}
}
], - "order_tax_amount": 333,
- "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",
- "organization_name": "string",
- "phone": "+44795465131",
- "postal_code": "W1G 0PW",
- "region": "OH",
- "street_address": "33 Cavendish Square",
- "street_address2": "Floor 22 / Flat 2",
- "title": "Mr."
}, - "intent": "buy"
}
Use this API call to get a Klarna Payments session. You can read the Klarna Payments session at any time after it has been created, to get information about it. This will return all data that has been collected during the session. Read more on Read an existing payment session.
successful operation
You were not authorized to execute this operation.
The session does not exist.
curl -i -X GET \ 'https://api.klarna.com/payments/v1/sessions/{session_id}'
{- "acquiring_channel": "ECOMMERCE",
- "attachment": {
- "body": "{\"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\"}]}",
- "content_type": "application/vnd.klarna.internal.emd-v2+json"
}, - "authorization_token": "string",
- "billing_address": {
- "attention": "Attn",
- "city": "London",
- "country": "GB",
- "email": "test.sam@test.com",
- "family_name": "Andersson",
- "given_name": "Adam",
- "organization_name": "string",
- "phone": "+44795465131",
- "postal_code": "W1G 0PW",
- "region": "OH",
- "street_address": "33 Cavendish Square",
- "street_address2": "Floor 22 / Flat 2",
- "title": "Mr."
}, - "client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
- "custom_payment_method_ids": [
- "string"
], - "customer": {
- "date_of_birth": "1978-12-31",
- "gender": "male",
- "organization_entity_type": "LIMITED_COMPANY",
- "organization_registration_id": "string",
- "title": "Mr.",
- "type": "organization",
- "vat_id": "string"
}, - "design": "string",
- "expires_at": "2038-01-19T03:14:07.000Z",
- "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": {
}, - "options": {
- "color_border": "#FF9900",
- "color_border_selected": "#FF9900",
- "color_details": "#FF9900",
- "color_text": "#FF9900",
- "radius_border": "5px"
}, - "order_amount": 2000,
- "order_lines": [
- {
- "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",
- "global_trade_item_number": "4912345678904",
- "manufacturer_part_number": "AD6654412-334.22",
- "color": "white",
- "size": "small"
}, - "quantity": 1,
- "quantity_unit": "pcs",
- "reference": "AD6654412",
- "tax_rate": 2000,
- "total_amount": 2000,
- "total_discount_amount": 500,
- "total_tax_amount": 333,
- "type": "physical",
- "unit_price": 2500,
- "subscription": {
- "name": "string",
- "interval": "DAY",
- "interval_count": 1
}
}
], - "order_tax_amount": 333,
- "payment_method_categories": [
- {
- "asset_urls": {
}, - "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",
- "organization_name": "string",
- "phone": "+44795465131",
- "postal_code": "W1G 0PW",
- "region": "OH",
- "street_address": "33 Cavendish Square",
- "street_address2": "Floor 22 / Flat 2",
- "title": "Mr."
}, - "status": "complete",
- "intent": "buy"
}
Use this API call to cancel/release an authorization. If the authorization_token
received during a Klarna Payments won’t be used to place an order immediately you could release the authorization.
Read more on Cancel an existing authorization.
The authorization was cancelled successfully.
You were not authorized to execute this operation.
The authorization does not exist.
curl -i -X DELETE \ 'https://api.klarna.com/payments/v1/authorizations/{authorizationToken}'
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.
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.
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.
auto_capture | boolean Default: false Allow merchant to trigger auto capturing. |
object (address) | |
custom_payment_method_ids | Array of strings 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. |
object (customer) | |
locale | string^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$ Used to define the language and region of the customer. The locale follows the format of RFC 1766, meaning its value consists of language-country. Read more on Supported Locals and Currencies. |
merchant_data | string [ 0 .. 6000 ] characters 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_reference1 | string [ 0 .. 255 ] characters Used for storing merchant's internal order number or other reference. |
merchant_reference2 | string [ 0 .. 255 ] characters Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters). |
object (merchant_urls) | |
order_amount required | integer <int64> >= 0 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. |
required | Array of objects (order_line) [ 1 .. 1000 ] items The array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order. |
order_tax_amount | integer <int64> >= 0 Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500. |
purchase_country required | string^[A-Za-z]{2,2}$ 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_currency required | string^[A-Za-z]{3,3}$ The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc. |
object (address) |
Order was successfully created.
We were unable to create an order with the provided data. Some field constraint was violated.
You were not authorized to execute this operation.
The authorization does not exist.
The data in the request does not match the session for the authorization.
{- "auto_capture": false,
- "billing_address": {
- "attention": "Attn",
- "city": "London",
- "country": "GB",
- "email": "test.sam@test.com",
- "family_name": "Andersson",
- "given_name": "Adam",
- "organization_name": "string",
- "phone": "+44795465131",
- "postal_code": "W1G 0PW",
- "region": "OH",
- "street_address": "33 Cavendish Square",
- "street_address2": "Floor 22 / Flat 2",
- "title": "Mr."
}, - "custom_payment_method_ids": [
- "string"
], - "customer": {
- "date_of_birth": "1978-12-31",
- "gender": "male",
- "last_four_ssn": "string",
- "national_identification_number": "string",
- "organization_entity_type": "LIMITED_COMPANY",
- "organization_registration_id": "string",
- "title": "Mr.",
- "type": "organization",
- "vat_id": "string"
}, - "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": {
}, - "order_amount": 2000,
- "order_lines": [
- {
- "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",
- "global_trade_item_number": "4912345678904",
- "manufacturer_part_number": "AD6654412-334.22",
- "color": "white",
- "size": "small"
}, - "quantity": 1,
- "quantity_unit": "pcs",
- "reference": "AD6654412",
- "tax_rate": 2000,
- "total_amount": 2000,
- "total_discount_amount": 500,
- "total_tax_amount": 333,
- "type": "physical",
- "unit_price": 2500,
- "subscription": {
- "name": "string",
- "interval": "DAY",
- "interval_count": 1
}
}
], - "order_tax_amount": 333,
- "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",
- "organization_name": "string",
- "phone": "+44795465131",
- "postal_code": "W1G 0PW",
- "region": "OH",
- "street_address": "33 Cavendish Square",
- "street_address2": "Floor 22 / Flat 2",
- "title": "Mr."
}
}
{- "authorized_payment_method": {
- "number_of_days": 0,
- "number_of_installments": 0,
- "type": "invoice"
}, - "fraud_status": "string",
- "order_id": "string",
}
Use this API call to create a Klarna Customer Token.
After having obtained an authorization_token
for a successful authorization, this can be used to create a purchase token instead of placing the order. Creating a Klarna Customer Token results in Klarna storing customer and payment method details.
Read more on Generate a costumer token.
Token was successfully created.
We were unable to create a customer token with the provided data. Some field constraint was violated.
You were not authorized to execute this operation.
The authorization does not exist.
The data in the request does not match the session for the authorization.
{- "billing_address": {
- "attention": "Attn",
- "city": "London",
- "country": "GB",
- "email": "test.sam@test.com",
- "family_name": "Andersson",
- "given_name": "Adam",
- "organization_name": "string",
- "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",
- "last_four_ssn": "string",
- "national_identification_number": "string",
- "organization_entity_type": "LIMITED_COMPANY",
- "organization_registration_id": "string",
- "title": "Mr.",
- "type": "organization",
- "vat_id": "string"
}, - "description": "string",
- "intended_use": "SUBSCRIPTION",
- "locale": "en-GB",
- "purchase_country": "GB",
- "purchase_currency": "GBP"
}
{- "billing_address": {
- "attention": "Attn",
- "city": "London",
- "country": "GB",
- "email": "test.sam@test.com",
- "family_name": "Andersson",
- "given_name": "Adam",
- "organization_name": "string",
- "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"
}, - "payment_method_reference": "0b1d9815-165e-42e2-8867-35bc03789e00",
- "token_id": "0b1d9815-165e-42e2-8867-35bc03789e00"
}