Skip to content

Place trial order without account

/klarna_payments/place_trial_order_without_account

Info

Target audience: Developers

Place trial order without account

Introduction

This endpoint creates a klarna payments trial order, without the need of an existing customer account. Meaning a free campaign that transitions to a standard subscription. The purchase session used to initiate the purchase must support this.

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.

Klarna payments only supports the use of Direct Debit when doing 0 amount purchases. This requires you to initialize your klarna widget correctly.

URI

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

Requirements

Identity Scope
No /external/klarna_payments/w

Curl example

curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/klarna_payments/place_trial_order_without_account \
  --header 'authorization: Bearer <token>' \
  --header 'content-type: application/json' \
  --data '{
    "customer_info": {
      "contact_email": "payway@adeprimo.se",
      "first_name": "Payway",
      "last_name": "Adeprimo"
    },
    "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
customer_info Object containing information about the customer that should be registered Yes
contact_email
Email of the customer Yes
first_name
First name of the customer. Will be overwritten by information fetched from Klarna, if the customer already has a Klarna account. No
last_name
Last name of the customer. Will be overwritten by information fetched from Klarna, if the customer already has a Klarna account. No
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 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
custom_urls Information about custom URL's, ie. where to send the user afterwards No
reset_password_url
Absolute URI to a page allowing the customer to reset their current password e.g. "https://adeprimo.se/reset-password" No
return_url
Absolute URI to a page where the customer should be sent after a successful purchase e.g. "https://adeprimo.se/" 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",
    "account_id": "6093a11609c04c0ad94a4b9b",
    "account_status": "created"
  }
}

Parameter Description
redirect_url Url where you should redirect the user
pw_order_id Payway order-id
klarna_order_id Klarna order-id
account_id The account-id of the registered customer account
account_status Can be known or created. Explains whether the account was known since before, or if a new account was registered.

Errors

This API uses the common error conventions of the Payway API

See common error responses