/create_session

/klarna_payments/create_session

Info

Target audience: Developers

Introduction

This endpoint creates a klarna payments purchase session. Needed for placing a klarna payments order.

Attention

This API gives access to Klarna payments related endpoints. Since this section is quite specific it has it's own section of documentation. See here for more information.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/klarna_payments/create_session
Production https://backend.worldoftulo.com/external/api/v1/klarna_payments/create_session

Requirements

Identity Scope
Yes /external/klarna_payments/w

Curl example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/klarna_payments/create_session \
  --header 'authorization: Bearer <token-with-identity>' \
  --header 'content-type: application/json' \
  --data '{
    "code": "adeprimo_digital",
    "period_type": "recurring",
    "period_id": "5f0d9ea795cfebfb8544ab12,",
    "confirmation_url": "https://confirmation_url.com"
  }'

Parameters

The request should be sent as application/json.

Parameter Description Required Format
code The code of the package or campaign e.g. adeprimo_digital Yes String
period_type limited or recurring. Always set to recurring for campaigns Yes String
period_id Specific payment period id. Required for trial orders For trial orders but not regular orders. Use payment periods API for fetching available payment periods String
confirmation_url URL to your confirmation page for the customer Yes String

Response

The response is sent as application/json.

Example of a successful response:

1
2
3
4
5
6
{
  "item": {
    "klarna_payments_session_id": "5aba2ca36fc93613f8000012",
    "klarna_client_token": "eyJhbGciOIJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjAwMDAwMDAwMDAtMDAwMDAtMDAwMC0wMDAwMDAwMC0wMDAwIiwidXJsIjoiaHR0cHM6Ly9jcmVkaXQtZXUua2xhcm5hLmNvbSJ9.A_rHWMSXQN2NRNGYTREBTkGwYwtm-sulkSDMvlJL87M"
  }
}

Parameter Description
klarna_payments_session_id The id of the session that you just created. This is needed when you place the order. You should store this in the user's session in your backend
klarna_client_token You need to use this token when you build the Klarna Payments Widget on your site

Errors

This API uses the common error conventions of the Payway API

See common error responses