When making Klarna payments, you need to specify price and product information when:
- Making a payment request.
- Making a partial capture or a partial refund request.
- Applying a discount.
Payment request
For a /payments request, include the following price and product information in lineItems:
{
"amount":{
"currency":"EUR",
"value":"1000"
},
"lineItems":[
{
"quantity":"1",
"amountExcludingTax":"331",
"taxPercentage":"2100",
"description":"Shoes",
"id":"Item #1",
"taxAmount":"69",
"amountIncludingTax":"400",
"productUrl": "URL_TO_PURCHASED_ITEM",
"imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
},
{
"quantity":"2",
"amountExcludingTax":"248",
"taxPercentage":"2100",
"description":"Socks",
"id":"Item #2",
"taxAmount":"52",
"amountIncludingTax":"300",
"productUrl": "URL_TO_PURCHASED_ITEM",
"imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
}
]
...
}
Klarna will only approve the payment if the total amount specified in lineItems
matches the amount.value
.
productUrl
and imageUrl
are optional.
Partial capture or refund request
For a partial capture or a partial refund request, include the price and product information in the openinvoicedata fields of additionalData
.
Although the field names are different, the information in additionalData.openinvoicedata
is the same as what you provided in lineItems
when making a /payments request:
openinvoicedata | lineItems | Description | Required |
---|---|---|---|
itemAmount |
amountExcludingTax |
The price for one item, without the tax, in minor units. | ![]() |
itemVatPercentage |
taxPercentage |
The tax percentage, in minor units. | ![]() |
itemVatAmount |
taxAmount |
The tax amount for one item, in minor units. |
The following example shows how to make a partial capture request if the shopper only kept one pair of socks from the two included in the original payment request.
{
"originalReference":"COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"merchantAccount":"YOUR_MERCHANT_ACCOUNT",
"modificationAmount":{
"currency":"EUR",
"value":"700"
},
"additionalData":{
"openinvoicedata.numberOfLines":"2",
"openinvoicedata.line1.currencyCode":"EUR",
"openinvoicedata.line1.description":"Shoes",
"openinvoicedata.line1.itemAmount":"331",
"openinvoicedata.line1.itemVatAmount":"69",
"openinvoicedata.line1.itemVatPercentage":"2100",
"openinvoicedata.line1.numberOfItems":"1",
"openinvoicedata.line1.productUrl":"URL_TO_PURCHASED_ITEM",
"openinvoicedata.line1.imageUrl":"URL_TO_PICTURE_OF_PURCHASED_ITEM",
"openinvoicedata.line2.currencyCode":"EUR",
"openinvoicedata.line2.description":"Socks",
"openinvoicedata.line2.itemAmount":"248",
"openinvoicedata.line2.itemVatAmount":"52",
"openinvoicedata.line2.itemVatPercentage":"2100",
"openinvoicedata.line2.numberOfItems":"1",
"openinvoicedata.line2.productUrl":"URL_TO_PURCHASED_ITEM",
"openinvoicedata.line2.imageUrl":"URL_TO_PICTURE_OF_PURCHASED_ITEM"
},
"reference":"YOUR_CAPTURE_REFERENCE"
}
For Klarna to approve the partial capture, the value
specified in the modificationAmount
has to match the total amount calculated from the invoice lines.
Discount lines
If you want to apply a discount to the invoice, there are several ways you can do this:
- Apply a discount to individual line items.
- Apply a discount to the whole purchase.
- Let Adyen add a discount line for you. This is your fallback option in case the other methods don't work for you.
Let's look at some examples (below) where you want to apply a 30% discount and the shopper's basket has:
- One pair of shoes, original price 12,00 EUR incl. 20% VAT
- Two pairs of socks, original price 4,50 EUR incl. 20% VAT each.
Change the line item amounts
With this method of applying a discount, you don't apply a discount to the basket as a whole. Instead, you reduce the amounts of each line item. In this way you can apply different discount percentages per item.
{
"amount" : {
"currency" : "EUR",
"value" : "1470"
},
"lineItems" : [
{
"quantity" : "1",
"amountExcludingTax" : "700",
"taxPercentage" : "2000",
"description" : "Shoes (with discount)",
"id" : "Item #1",
"taxAmount" : "140",
"amountIncludingTax" : "840"
},
{
"quantity" : "2",
"amountExcludingTax" : "263",
"taxPercentage" : "2000",
"description" : "Socks (with discount)",
"id" : "Item #2",
"taxAmount" : "52",
"amountIncludingTax" : "315"
}
]
}
Apply a discount to the whole purchase
With this method of applying a discount, you specify the line items with their original price and then apply a discount to the basket as a whole by adding a discount line.
The discount line has:
id
anddescription
: DiscountamountExcludingTax
,taxAmount
andamountIncludingTax
: The discount amounts (add a minus sign).
{
"amount" : {
"currency" : "EUR",
"value" : "1470"
},
"lineItems" : [
{
"quantity" : "1",
"amountExcludingTax" : "1000",
"taxPercentage" : "2000",
"description" : "Shoes",
"id" : "Item #1",
"taxAmount" : "200",
"amountIncludingTax" : "1200"
},
{
"quantity" : "2",
"amountExcludingTax" : "375",
"taxPercentage" : "2000",
"description" : "Socks",
"id" : "Item #2",
"taxAmount" : "75",
"amountIncludingTax" : "450"
},
{
"quantity" : "1",
"amountExcludingTax" : "-504",
"taxPercentage" : "2000",
"description" : "Discount",
"id" : "Discount",
"taxAmount" : "-126",
"amountIncludingTax" : "-630"
}
]
}
Let us add a discount line for you
With this method of applying a discount, we calculate that the payable amount (amount.value
) is less than the total value of the line items, so a discount was applied. We will add a discount line for you.
{
"amount" : {
"currency" : "EUR",
"value" : "1470"
},
"lineItems" : [
{
"quantity" : "1",
"amountExcludingTax" : "1000",
"taxPercentage" : "2000",
"description" : "Shoes",
"id" : "Item #1",
"taxAmount" : "200",
"amountIncludingTax" : "1200"
},
{
"quantity" : "2",
"amountExcludingTax" : "375",
"taxPercentage" : "2000",
"description" : "Socks",
"id" : "Item #2",
"taxAmount" : "75",
"amountIncludingTax" : "450"
}
]
}