Klarna

Klarna allows the consumer to purchase a product and then be billed for it afterward.

Klarna offers the following payment options:

  • Invoice–Allows a shopper who receives a Klarna bill to pay the balance after delivery.

  • Card installments–Allows a partial payment at approval and the balance to be collected later at specific times at 0%.

  • Pay later in parts or Financing–Allows the shopper to finance the order at an interest-bearing installment plan.

Financing orders reduce cart abandonment and improve conversions at a higher average order value. There are unique display and entry requirements for each country. Please contact your Digital River Representative for more details.

Create a Klarna payment method for your app or website in five easy steps:

Step 1. Build a Klarna source request object

Important: The Klarna payment type does not support recurring payments. For recurring payments, you must use the klarnaCreditRecurring payment type.

A Klarna source request object requires the following fields.

Klarna source request object

Field

Value

type

klarnaCredit

amount

The total value of the transaction.

currency

The currency of the transaction.

owner

An Owner object.

klarnaCredit

A Klarna Source Details object that includes the details of the transaction.

Klarna source details object

The Klarna source details object requires the following fields.

{
"returnUrl": "https://redirectUrl.com",
"cancelUrl": "https://cancelurl.com",
"items": [{
"name": "Digital River Office Productivity for Students (Subscription)",
"quantity": 1,
"unitAmount": 99.99,
"category": "digital",
"sku": "SKU123",
"productUrl": "https://myproduct.com",
"imageUrl": "https://someimage.com",
"taxRate": 0.10
}, {
"name": "Digital River Head Phones",
"quantity": 1,
"unitAmount": 97.49,
"category": "physical",
"sku": "SKU1234",
"productUrl": "https://myproduct.com",
"imageUrl": "https://someimage.com",
"taxRate": 0.10
}],
"locale": "en_US",
"discountAmount": 10,
"taxAmount": 15.24,
"shippingAmount": 5,
"shipping": {
"recipient": "John Doe",
"email": "jdoe@yahoo.com",
"phoneNumber": "5559895326",
"address": {
"line1": "10380 Bren Road West",
"line2": null,
"city": "Minnetonka",
"state": "MN",
"country": "US",
"postalCode": "55343"
}
},
"accountId": "testaccount1",
"accountCreatedDate": "2019-11-11",
"accountUpdatedDate": "2019-11-12",
"hasPaidBefore": true,
"subscriptionDescription": "New Sub",
"subscriptionStartDate": "2019-12-10",
"subscriptionEndDate": "2020-12-12",
"autoRenewal": true,
"affiliateName": "Merchant1"
}

Field

Required/Optional

Description

returnUrl

Required

If you choose to utilize the full redirect flow, this is where your Customer will be redirected to after authorizing within the Klarna experience.

cancelUrl

Required

If you choose to utilize the full redirect flow, this is where your Customer will be redirected to after cancelling within the Klarna experience.

items

Required

An array of Klarna Item objects.

locale

Optional

A locale used to localize the experience within Klarna. If not provided, the language will be selected based on the Owner country.

discountAmount

Optional

The amount of order level discount.

taxAmount

Required

The value of the total tax amount of the transaction.

shippingAmount

Optional

The value of the total shipping amount of the transaction.

shipping

Optional

A Klarna Shipping Information Object.

accountId

Optional

An upstream identifier of the Customer.

accountCreatedDate

Optional

The date when the Customer's account was created. Provided in YYYY-MM-DD format.

accountUpdatedDate

Optional

The date when the Customer's account was last updated. Provided in YYYY-MM-DD format.

hasPaidBefore

Optional

Whether the Customer has paid previously.

subscriptionDescription

Optional

A description of the subscription.

subscriptionStartDate

Optional

The date when the subscription will start. Provided in YYYY-MM-DD format.

subscriptionEndDate

Optional

The date when the subscription will end. Provided in YYYY-MM-DD format.

autoRenewal

Optional

Whether the subscription will automatically renew.

affiliateName

Optional

An identifier of an affiliate marketing program.

Klarna item object

{
"name": "Cell Phone (Unlocked)",
"quantity": 1,
"unitAmount": 100,
"category": "digital",
"sku": "SKU123",
"productUrl": "https://myproduct.com",
"imageUrl": "https://someimage.com",
"taxRate": 0.10,
"discountAmount": 1
}

Field

Required/Optional

Description

Notes

name

Required

The name of the item that will be displayed on the Klarna authorize screen.

quantity

Required

The quantity of the item that will be displayed on the Klarna authorize screen.

unitAmount

Required

The sale price amount of the item.

category

Optional

The category of the item. Options are: physical or digital.

This field is highly encouraged to increase conversion.

sku

Optional

The SKU identifier of the item.

This field is highly encouraged to increase conversion.

productUrl

Optional

The URL to the product details page of the item.

This field is highly encouraged to increase conversion.

imageUrl

Optional

The URL of an image that will be displayed in the Klarna authorize screen.

This field is highly encouraged to increase conversion.taxRate

taxRate

Required

The tax rate used to calculate the unitAmount. The value for tax-inclusive price must be a non-0 number, and the value for tax-exclusive pricing will be 0. This should be represented as a decimal value.

Klarna shipping information object

{
"recipient": "John Doe",
"phoneNumber": "555-555-1212",
"address": {
"line1": "10380 Bren Road West.",
"line2": "null",
"city": "Minnetonka",
"state": "MN",
"country": "US",
"postalCode": "55341",
"country": "US"
}

Field

Required/Optional

Description

recipient

Required

The full name of the person receiving the shipment.

phoneNumber

Required

The phone number of the person receiving the shipment.

address

Required

A Klarna Shipping Address object, which contains the Shipping Address of the person receiving the shipment.

Klarna shipping address object

{
"line1": "54321 Fake St.",
"line2": "Apt. 3C",
"city": "Minnetonka",
"state": "MN",
"postalCode": "55341"
"country": "US"
}

Field

Required/Optional

Description

line1

Required

The first line of the Customer's billing address.

line2

Required

The second line of the Customer's billing address.

city

Required

The name of the city associated with the Customer's billing address.

state

Required

The state/country/province/region associated with the Customer's billing address.

postalCode

Required

The ZIP or postal code associated with the Customer's billing address.

country

Required

The two-letter country code associated with the Customer's billing address.

Step 2. Create a Klarna source using DigitalRiver.js

To create a Klarna payment source, you must use the createSource method exposed via DigitalRiver.js.

var data = {
"type" : "klarnaCredit",
"owner" : {
"firstName" : "firstName",
"lastName" : "lastName",
"email" : "email@email.org",
"phoneNumber" : "9522253720",
"address" : {
"line1" : "line1",
"line2" : "line2",
"city" : "Minnetonka",
"state" : "MN",
"country" : "US",
"postalCode" : "55410"
}
},
"sessionId" : "3aa75613-9596-438a-9604-67e20016aa96",
"klarnaCredit" : {
"returnUrl" : "http://example.org/return",
"cancelUrl" : "http://example.org/cancel"
}
}
digitalriver.createSource(data).then(function(result) {
if (result.error) {
//handle errors
} else {
var source = result.source;
//send source to back end
sendToBackend(source);
}
});

Klarna source example

{
"clientId": "gc",
"channelId": "drdod15",
"liveMode": false,
"id": "231fa002-3831-4ded-9705-4a455df2697b",
"clientSecret": "231fa002-3831-4ded-9705-4a455df2697b_3341d8c6-e66b-43a5-af4b-c623459b44af",
"type": "klarnaCredit",
"reusable": false,
"owner": {
"firstName": "John",
"lastName": "Doe",
"email": "jdoe@yahoo.com",
"phoneNumber": "5559895326",
"address": {
"line1": "10380 Bren Road West",
"line2": "",
"city": "Minnetonka",
"state": "MN",
"country": "US",
"postalCode": "55343"
}
},
"amount": "210.50",
"currency": "USD",
"state": "pending_redirect",
"creationIp": "10.81.3.92",
"createdTime": "2020-02-27T01:10:57.513Z",
"updatedTime": "2020-02-27T01:10:57.513Z",
"flow": "redirect",
"redirect": {
"redirectUrl": "https://api.digitalriverws.com:443/payments/redirects/bca8a56b-7afb-4670-891c-313630ef748e?apiKey=pk_hc_e03ee62c0d964bb3ac75595b1203d13c",
"returnUrl": "https://yourdomain.com?paymentAction=success",
"cancelUrl": "https://yourdomain.com?paymentAction=failure"
},
"klarnaCredit": {
"shipping": {
"recipient": "John Doe",
"phoneNumber": "5559895326",
"address": {
"line1": "10380 Bren Road West",
"city": "Minnetonka",
"state": "MN",
"country": "US",
"postalCode": "55343"
},
"email": "jdoe@yahoo.com"
},
"token": "63449012720000000000000534937705"
}
}

Step 3. Authorize the Klarna source

When you create a Klarna source, the customer is required to authorize the charge through Klarna. You can accomplish this by redirecting the customer to Klarna, where they will be presented with different payment options.

Redirecting the customer to Klarna for authorization

To redirect your customer to Klarna for authorization, use the redirectUrl parameter in your createSource response.

HTML
HTML
window.location.href = sourceResponse.redirect.redirectUrl;

At Klarna, the customer will be presented with the transaction details where they can authorize or cancel the transaction. If the authorization is successful, the customer will be redirected to the returnUrl parameter you specified when creating the source. If the customer cancels, they will be returned to the cancelURL parameter you specified when creating the source.

Step 4. Use the authorized source

Once authorized, you can use the source by attaching it to a checkout.

Attach the source to a checkout

POST /checkouts/{id}
POST /checkouts/{id}
{
"customerId": "5774321008",
"sourceId": "src_a78cfeae-f7ae-4719-8e1c-d05ec04e4d37"
}

Step 5. Support recurring payments

Note: To support recurring payments, use a payment type of klarnaCreditRecurring in the createSource request. Only use the Klarna Recurring payment type for recurring payments. Klarna Recurring uses a different type of agreement with the lender, Klarna, to facilitate the recurring payments.

For standard payments, you must use the Klarna payment type.

Field

Value

type

klarnaCreditRecurring

amount

klarnaCreditRecurring

currency

The currency of the transaction.

owner

An Owner object.

klarnaCreditRecurring

A Klarna Source Details object that includes the details of the transaction.

Klarna recurring source example

var data = {
"type" : "klarnaCreditRecurring",
"owner" : {
"firstName" : "firstName",
"lastName" : "lastName",
"email" : "email@email.org",
"phoneNumber" : "9522253720",
"address" : {
"line1" : "line1",
"line2" : "line2",
"city" : "Minnetonka",
"state" : "MN",
"country" : "US",
"postalCode" : "55410"
}
},
"sessionId" : "3aa75613-9596-438a-9604-67e20016aa96",
"klarnaCreditRecurring" : {
"returnUrl" : "http://example.org/return",
"cancelUrl" : "http://example.org/cancel"
}
}
digitalriver.createSource(data).then(function(result) {
if (result.error) {
//handle errors
} else {
var source = result.source;
//send source to back end
sendToBackend(source);
}
});

Additional setup required: If you are interested in using Klarna, contact your Account Manager. The Account Manager will send set up instructions for Klarna Banners after you sign the client addendum.

Supported geographies

Supported Country

Payment Method Type

Currency

Minimum Order Amount

Maximum Order Amount

Austria

Pay Later (Invoice)

EUR

0.1

10,000

Austria

Financing

EUR

0.1

10,000

Denmark

Pay Later (Invoice)

DKK

1

20,000

Denmark

Financing

DKK

1

20,000

Finland

Pay Later (Invoice)

EUR

0.1

3,000

Finland

Financing

EUR

0.1

3,000

Germany

Pay Later (Invoice)

EUR

0.1

1,500

Germany

Financing

EUR

0.1

1,500

Netherlands

Pay Later (Invoice)

EUR

0.1

1,500

Norway

Pay Later (Invoice)

NOK

1

75,000

Norway

Financing

NOK

1

75,000

Sweden

Pay Later (Invoice)

SEK

1

100,000

Sweden

Financing

SEK

1

100,000

United Kingdom

Slice It in 3

GBP

35

800

United Kingdom

Pay Later (Invoice)

GBP

35

600

United States

Slice It in 4

USD

35

1,000