Skip to main content

Klarna

Klarna Payments is an alternative payment method that complements your checkout with Pay Later, Instalments, and Pay Now options. In addition to processing payments, Klarna Payments integration also offers real-time credit decisioning and fraud detection services out of the box. In order to enable Klarna Payments you will need to apply for a Klarna merchant account which you can do via the Merchant Portal.

Please discuss how to enable Klarna payments with your Account Manager. They will be able to guide you through the process and pricing for your Klarna experience.

Klarna Integration fields

Klarna processing requires some additional information to be passed in the Payment Request which are marked as Conditional in their description elsewhere in this guide. For clarity, these objects and arrays are referenced below as well, to provide clearer guidance on the implementation of Klarna for anyone currently using the solution.

Klarna fields
Field NameLocationDescription
titlecustomerDetails.billingAddressCardholder's title.This field is Optional and is restricted to these values:
MrDesignates a Male cardholder.
MsDesignates a Female cardholder.
citycustomerDetails.billingAddressCity of the cardholders billing address.

This field is Mandatory
phonecustomerDetails.billingAddressPhone number of the cardholders billing address.

This field is Mandatory
titlecustomerDetails.deliveryDetails.deliveryAddressCardholder's title.This field is Optional and is restricted to these values:
MrDesignates a Male cardholder.
MsDesignates a Female cardholder.
citycustomerDetails.deliveryDetails.deliveryAddressCity of the cardholders delivery address.

This field is Mandatory
orderLinespaymentRequestThis array can contain multiple objects, each one containing several Mandatory and Optional fields. These are detailed fully within the Payment Request section of this guide.
amountBreakdownpaymentRequestThis object contains several objects related to Klarna processing. Each of these can contain several amount fields which breakdown the total sales value into sub amounts. This object is optional for Klarna.
shippingamountBreakdownThis object contains the totalAmount field only. This optional field should be the total amount of shipping for this order.
discountamountBreakdownThis object contains the totalAmount field only. This optional field should be the total amount of discount for this order.
attachmentpaymentRequestThis field is a serialised JSON Object string, which should contain the information as per the object schema. Details on this schema are included below in the Attachment Field Details section of this page.

This data should be supplied IF available.
Failure to do so may result in lower payment acceptance.
Advertising your Klarna Acceptance

Klarna is a form of credit so has some usage guidelines around how it should be promoted on your website. Klarna make these guidelines available online for you to use and follow. We strongly recommend reading through their UK marketing guidelines.

Klarna in Checkout already meets the payment application requirements that are required for this Alternate Payment Method. Once configured, it can be used without any further amendments to your website. Klarna also provide optional guidance and tools however, which are designed to maximise payment acceptance using this Payment Method.


Attachment Field Details

Schema Usage

Klarna maintain the schema for the attachment field at:

https://developers.klarna.com/api/specs/attachment-schema.json

This schema can be checked by using a HTTP GET sent to the endpoint and we recommend that you use this method to ensure you are always using the most up to date schema for this field. The table below summarises the usage guidance for each attachment option, and is followed by the Schema examples in JSON format, at time of publishing.

PropertyDescription
air_reservation_detailsDetails about the reservation of airline tickets.
bus_reservation_detailsDetails about the reservation of bus tickets.
train_reservation_detailsDetails about the reservation of train tickets.
ferry_reservation_detailsDetails about the reservation of ferry tickets.
hotel_reservation_detailsDetails about the reservation of hotel rooms.
car_rental_reservation_detailsDetails about the reservation of rental cars.
eventDetails about the event, show or gig.
voucherDetails about the voucher and its intended use.
subscriptionDetails about the product or service being subscribed to.
marketplace_seller_infoDetails about the seller, if the purchase is via a marketplace e.g. Ebay.
marketplace_winner_infoDetails about the buyer, if the purchase is via a marketplace e.g. Ebay.
customer_account_infoDetails about the customer who holds an account with the merchant.
payment_history_fullDetails about the payment history of the buyer.
payment_history_simpleA summary of the payment history of the buyer.
other_delivery_addressDetails of any alternative delivery addresses being requested by the buyer.

Serialised JSON Object string example

"{\"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\"}]}"

You can find more information on serialising JSON Objects into strings at Newtonsoft.com. The below Schema can be used to validate your JSON Object prior to serialising it, but the full schema can be viewed here.

Attachment JSON Schema 1

air_reservation_details
{
"description": "Details about the reservation of airline tickets",
"type": "array",
"items":
{
"type": "object",
"properties":
{
"pnr":
{
"description": "Trip booking number, e.g. VH67899",
"type": "string"
},
"itinerary":
{
"description": "Itinerary data, one per segment",
"type": "array",
"items":
{
"type": "object",
"properties":
{
"departure":
{
"description": "IATA Airport Code (three letters)",
"minLength": 3,
"maxLength": 3,
"type": "string"
},
"departure_city":
{
"type": "string"
},
"arrival":
{
"description": "IATA Airport Code (three letters)",
"minLength": 3,
"maxLength": 3,
"type": "string"
},
"arrival_city":
{
"type": "string"
},
"carrier":
{
"description": "IATA Airline standard (two letters or digits)",
"type": "string"
},
"segment_price":
{
"description": "Local currency",
"type": "number"
},
"departure_date":
{
"description": "ISO 8601 e.g. 2012-11-24T15:00",
"type": "string",
"format": "date-time",
"pattern": "^[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9](:[0-5][0-9]){0,1}Z{0,1}$"
},
"ticket_delivery_method":
{
"enum":
[
"pick_up",
"email",
"post",
"phone"
]
},
"ticket_delivery_recipient":
{
"description": "The name of the recipient the ticket is delivered to. If email or phone, then use either the email address or the phone number.",
"type": "string"
},
"passenger_id":
{
"type": "array",
"items":
{
"type": "integer"
}
},
"class":
{
"type": "string"
}
}
}
},
"insurance":
{
"description": "Insurance data",
"type": "array",
"items":
{
"type": "object",
"properties":
{
"insurance_company":
{
"type": "string"
},
"insurance_type":
{
"enum":
[
"cancellation",
"travel",
"cancellation_travel",
"bankruptcy"
]
},
"insurance_price":
{
"description": "Local currency",
"type": "number"
}
}
}
},
"passengers":
{
"description": "Passengers data",
"type": "array",
"items":
{
"name": "Person",
"type": "object",
"properties":
{
"id":
{
"type": "integer"
},
"title":
{
"description": "Mr, Mrs, Ms or blank if under 12 years",
"enum":
[
"mr",
"mrs",
"ms",
""
]
},
"first_name":
{
"type": "string"
},
"last_name":
{
"type": "string"
}
}
}
},
"affiliate_name":
{
"description": "Name of the affiliate that originated the purchase. If none, leave blank.",
"type": "string"
}
}
}
}

Attachment JSON Schema 2

marketplace_seller_info
{
"type": "array",
"items":
{
"type": "object",
"properties":
{
"unique_account_identifier_seller":
{
"type": "object",
"properties":
{
"email":
{
"type": "string",
"required": true
},
"pno":
{
"type": "string",
"required": true
},
"other":
{
"type": "string"
}
}
},
"sub_merchant_id":
{
"description": "Name or unique number of the selling / delivering merchant, e.g. \"Marketbrick Ltd.\"",
"type": "string"
},
"product_category":
{
"description": "Name of the overall category to which the specific good(s) belong to, according to the selling merchants categorization. E.g. \"Computers\"",
"type": "string"
},
"product_name":
{
"description": "Name of the specific good purchased, e.g. \"Acer 5400\"",
"type": "string"
},
"account_registration_date":
{
"description": "ISO 8601 e.g. 2012-11-24T15:00",
"type": "string",
"format": "date-time"
},
"account_last_modified":
{
"type": "object",
"properties":
{
"password":
{
"description": "ISO 8601 e.g. 2012-11-24T15:00",
"type": "string",
"format": "date-time",
"pattern": "^[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9](:[0-5][0-9]){0,1}Z{0,1}$"
},
"email":
{
"description": "ISO 8601 e.g. 2012-11-24T15:00",
"type": "string",
"format": "date-time",
"pattern": "^[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9](:[0-5][0-9]){0,1}Z{0,1}$"
},
"listing":
{
"description": "ISO 8601 e.g. 2012-11-24T15:00",
"type": "string",
"format": "date-time",
"pattern": "^[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9](:[0-5][0-9]){0,1}Z{0,1}$"
},
"login":
{
"description": "ISO 8601 e.g. 2012-11-24T15:00",
"type": "string",
"format": "date-time",
"pattern": "^[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9](:[0-5][0-9]){0,1}Z{0,1}$"
},
"address":
{
"description": "ISO 8601 e.g. 2012-11-24T15:00",
"type": "string",
"format": "date-time",
"pattern": "^[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9](:[0-5][0-9]){0,1}Z{0,1}$"
}
}
},
"seller_rating":
{
"description": "Current rating. Partner should provide upfront their rating scale, e.g. 65",
"type": "number"
},
"number_of_trades":
{
"description": "Number of trades the sub-merchant did since 12 months back, e.g. 23",
"type": "integer"
},
"volume_of_trades":
{
"description": "Volumes of trades the sub-merchant did since 12 months back, e.g. 230.5",
"type": "integer"
}
}
}
}

Example Request Code

The below code is a complete Payment Request which includes all the fields required for Klarna as an Alternative Payment Method. Please refer to the full Payment Request page for guidance on adding additional payment methods to this request.

window.DNAPayments.openPaymentPage(
{
currency: 'GBP',
description: 'CarService',
paymentSettings: {
terminalId: 'a398d836-aeae-44e8-90b3-6726ecbdb608',
returnUrl: 'https: //test-pay.dnapayments.com/checkout/success.html',
failureReturnUrl: 'https: //test-pay.dnapayments.com/checkout/failure.html',
callbackUrl: 'https: //pay.dnapayments.com/checkout',
failureCallbackUrl: 'https: //testmerchant/order/1123/fail'
},
customerDetails: {
accountDetails: {
accountId: 'uuid000001',
accountPurchaseCount: 4,
paymentAccountAgeIndicator: '05',
suspiciousAccountActivity: '01'
},
billingAddress: {
firstName: 'John',
lastName: 'Doe',
addressLine1: '12 FulhamRd',
postalCode: 'SW61HS',
city: 'London',
phone: '44-07123456789',
country: 'GB'
},
deliveryDetails: {
deliveryAddressUsageIndicator: '04',
deliveryIndicator: '01',
deliveryAddress: {
firstName: 'John',
lastName: 'Doe',
streetAddress1: '12 FulhamRd',
streetAddress2: 'Fulham',
postalCode: 'SW61HS',
city: 'London',
phone: '44-07123456789',
country: 'GB'
}
},
email: 'demo@dnapayments.com',
mobilePhone: '44-07123456789'
},
orderLines: [
{
name: 'Runningshoe',
quantity: 1,
unitPrice: 120,
taxRate: 20,
totalAmount: 120,
totalTaxAmount: 20,
imageUrl: 'https: //www.exampleobjects.com/logo.png',
productUrl: 'https: //.../AD6654412.html'
},
{
name: 'Tracksuit',
quantity: 2,
unitPrice: 30,
taxRate: 20,
totalAmount: 60,
totalTaxAmount: 10,
imageUrl: 'https: //www.exampleobjects.com/logo2.png',
productUrl: 'https: //.../AD6654125.html'
}
],
amount: 24,
amountBreakdown: {
shipping: {
totalAmount: 2
},
discount: {
totalAmount: 2
}
},
attachment: '{\"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\"}]}',
auth: {
access_token: 'qy/ZWj049WHUZj+8i1pUwmYxswo4GXK+Z5',
expires_in: 7200,
scope: 'payment integration_seamless',
token_type: 'Bearer'
}
)