Skip to content

Place order

/v1/klarna_payments/place_order

Info

Target audience: Developers

Place order

Introduction

This endpoint performs a klarna payments purchase. Note that this endpoint might affect the information saved on the customer's account. You can read more about this here.

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/place_order
Production https://backend.worldoftulo.com/external/api/v1/klarna_payments/place_order

Requirements

Identity Scope
Yes /external/klarna_payments/w

Curl example

curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/klarna_payments/place_order \
  --header 'authorization: Bearer <token-with-identity>' \
  --header 'content-type: application/json' \
  --data '{
    "klarna_authorization_token": "klarna_authorization_token, received from klarna widget",
    "klarna_payments_session_id": "klarna_payments_session_id, received from create_session",
    "browser_ip": "81.208.13.50",
    "browser_language": "sv-SE",
    "browser_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36",
    "traffic_source": "facebook",
    "merchant_reference": "adeprimo-campaign-001",
    "raise_on_ssn_already_taken_error": true/false
    "raise_on_ssn_already_set_error": true/false
    "raise_on_account_update_error": true/false
    "raise_on_delivery_address_error": true/false
  }'

Request parameters

The request should be sent as application/json.

Parameter Description Default value Required
klarna_authorization_token The authorization token you aquired in step 4. Yes
klarna_payments_session_id The id of the session that was returned to you in the create_session call in step 2. Yes
browser_ip The IPv4 or IPv6 address of the browser e.g. 81.208.13.50 or 2002:51d0:0d32::51d0:0d32 Yes
browser_language The browser language e.g. sv-SE Yes
browser_user_agent The user agent Yes
traffic_source The source of the purchase. E.g. facebook, web. Traffic sources need to be setup in PAP
Size range: ..128
No
merchant_reference An optional customer reference, can be a code or an url. No
paywall_id The ID of the paywall.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
No
raise_on_ssn_already_taken_error If set to true the request will raise an exception if the ssn is already taken by another user in Payway true No
raise_on_ssn_already_set_error If set to true the request will raise an exception if an ssn update is performed on a user with an ssn false No
raise_on_account_update_error If set to true the request will raise an exception if errors are encountered during an account update. An account update consists of "name", "birth date" and "account address" updates. false No
raise_on_delivery_address_error If set to true the request will raise an exception if errors are encountered during the order delivery address validation false No

Response

The response is sent as application/json.

Example:

{
  "item": {
    "redirect_url": "http://url.to.klarna.se",
    "pw_order_id": "ORDER-123",
    "klarna_order_id": "c8328e81-d476-4e7d-9d03-5ae228240943"
  }
}

Parameter Description
redirect_url Url where you should redirect the user
pw_order_id Payway order-id
klarna_order_id Klarna order-id

Errors

This API uses the common error conventions of the Payway API

See common error responses