Place order
/v2/klarna_payments/place_order
Target audience: Developers
Place order¶
Release version: 4.7.5
Introduction¶
This endpoint performs a klarna payments
purchase without the need of an existing customer account. 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/v2/klarna_payments/place_order |
Production | https://backend.worldoftulo.com/external/api/v2/klarna_payments/place_order |
Requirements¶
Identity | Scope |
---|---|
No | /external/klarna_payments/w |
Curl example¶
curl --request POST \
--url https://payway-api.stage.adeprimo.se/external/api/v2/klarna_payments/place_order \
--header 'authorization: Bearer <token>' \
--header 'content-type: application/json' \
--data '{
"customer_info": {
"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 Note: This information may be overwritten by Klarna. Read more here. |
Yes | |
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 | |
mobile_phone_number |
The phone number. Must be a valid phone number, with or without country code | No | |
social_security_number |
The social security number. Must be a valid social security number (SSN) in the country of the organisation | No | |
birth_date |
The birth date. Must be in a DateTime parseable format | No | |
company_name |
Company name, if applicable | No | |
company_registration_number |
Company registration number (CRN), if applicable | No | |
account_origin |
The origin of the account | No | |
alias |
The alias of the account | No | |
address |
Address object | 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 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 | |
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 | No | |
return_url |
Absolute URI to where the customer should be redirected after resetting their password via the reset_password_url |
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