### Would you like to contact support?

No momento, esta página não está disponível em inglês

# Invoice lines and discounts

Include information about purchased items in your API requests and apply discounts.

When making Klarna payments, you need to specify price and product information when:

## Payment request

For a payment request, include price and product information in lineItems.

When adding price and product information, note that:

• Klarna will only approve the payment if the total amount specified in lineItems matches the amount.value.
• productUrl and imageUrl are optional fields.
Line items in payments request
{
"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"
}
]
...
}

## 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 the additionalData object.

Although the field names are different, the information in additionalData.openinvoicedata is the same as what you provided in lineItems when making a payment request. The following table shows the corresponding fields.

openinvoicedata lineItems Required Description
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.

For Klarna to approve a partial capture, the value specified in the modificationAmount has to match the total amount calculated from the invoice lines.

Below is an example of how you can make a partial capture if the shopper only kept one pair of socks from the two included in the original payment request.

Line items in capture request
curl https://pal-test.adyen.com/pal/servlet/Payment/v68/capture \
-H "content-type: application/json" \
-d '{
"originalReference":"COPY_PSP_REFERENCE_FROM_PAYMENT_RESPONSE",
"merchantAccount":"YOUR_MERCHANT_ACCOUNT",
"modificationAmount":{
"currency":"EUR",
"value":700
},
"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"
}'

You will receive a response containing a pspReference. Once we have processed your request, you will also receive a CAPTURE notification webhook.

## Discount lines

If you want to apply a discount to the invoice, there are several ways you can do this:

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 and description: Discount
• amountExcludingTax, taxAmount and amountIncludingTax: 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" : "-525",
"taxPercentage" : "2000",
"description" : "Discount",
"id" : "Discount",
"taxAmount" : "-105",
"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"
}
]
}