v1
latestOpenAPI 3.0.02026-07-1462248.4 KBsessions
Create a new payment session
Use this API call to create a Klarna Payments session.<br/>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.
post/payments/v1/sessions
Request body
Example request
{
"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",
"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",
"customer": {
"date_of_birth": "1978-12-31",
"gender": "male",
"title": "Mr.",
"type": "organization"
},
"expires_at": "2038-01-19T03:14:07.000Z",
"intent": "buy",
"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": {
"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"
},
"options": {
"color_border": "#FF9900",
"color_border_selected": "#FF9900",
"color_details": "#FF9900",
"color_text": "#FF9900",
"radius_border": "5px"
},
"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
successful operation
Example response
{
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"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"
}
],
"session_id": "0b1d9815-165e-42e2-8867-35bc03789e00"
}