When making Klarna payments, you need to specify price and product information when:
- Making a payment request.
- Making a partial capture request.
- Making a partial refund request.
- Applying a discount.
- Adjusting an authorization.
Make a payment request
For any 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 theamount.value
. productUrl
andimageUrl
are optional fields.
Make a partial capture request
For a partial capture request, include the price and product information in
additionalData.openinvoicedata
.
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.
You will receive a response containing a pspReference
. Once we have processed your request, you will also receive a CAPTURE webhook.
Make a partial refund request
For a partial refund request, include the price and product information in
additionalData.openinvoicedata
.
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. |
Below is an example of how you can partially refund a pair of socks from the original payment request.
You will receive a response containing a pspReference
. Once we have processed your request, you will also receive a REFUND webhook.
Apply a discount
There are several ways to apply a discount to the invoice:
- Apply a discount to individual line items.
- Apply a discount to the whole purchase.
- Let Adyen add a discount line for you. This is the fallback option in case the other methods do not work for you.
The examples below apply a 30% discount to the shopper's basket, which contains:
- One pair of shoes, original price EUR 12.00 including 20% VAT
- Two pairs of socks, original price EUR 4.50 including 20% VAT
Apply a discount to individual line items
With this method of applying a discount, you reduce the cost of the applicable line items instead of discounting the basket as a whole. To apply a discount to individual line items:
- Calculate the reduced amount of each line item you want to discount.
- Send a payment request in which each line item specifies the discounted amounts:
amountExcludingTax
taxAmount
amountIncludingTax
Product | Quantity | Item Price (EUR) | VAT (EUR) | Total price (EUR) |
---|---|---|---|---|
Shoes (with 30% discount) | 1 | 7,00 | 1,40 | 8,40 |
Socks (with 30% discount) | 2 | 2,63 | 0,52 | 6,30 |
Purchase amount | 12,26 | |||
VAT | 2,44 | |||
TOTAL | 14,70 |
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.
To apply a discount to the entire basket:
- Calculate the discount to the product total and the VAT.
- In your payments request, send each fully priced line item, plus a line Item to specify the discount with the following parameters:
id
: Discountdescription
: DiscountamountExcludingTax
: The discount amount, preceded by a minus signtaxAmount
: The discount amount, preceded by a minus signamountIncludingTax
: The discount amount, preceded by a minus sign
Product | Quantity | Item Price (EUR) | VAT (EUR) | Total price (EUR) |
---|---|---|---|---|
Shoes | 1 | 10,00 | 2,00 | 12,00 |
Socks | 2 | 3,75 | 0,75 | 9,00 |
Total before discount | 21,00 | |||
Product discount | 5,25 | |||
VAT discount | 1,05 | |||
Total discount (30%) | 6,30 | |||
TOTAL | 14,70 |
Let Adyen add a discount line for you
With this method of applying a discount, Adyen calculates that amount.value
is less than the total value of the line items, so a discount must have been applied. In this case, Adyen adds a line item for the discount before sending to Klarna.
Adjust an authorization
If you want to adjust an authorized payment that has not yet been fully captured, your API request must specify all captured and refunded lineItems
. See Adjust an authorization for detailed instructions. This is available for Klarna with Checkout API v70 and later.
Below are two examples of adjusting an authorized payment:
These examples are based on the following order:
Cancel part of the authorization before capture
If you want to cancel or adjust the authorization before capturing, you can declare the new amount and associated lineitems
.
The following example removes Item #2 from the above order by declaring the new basket composition and amount.
Add a product from a partially captured order
If you want to add products to a partially captured or refunded order, you must include the already captured or refunded lineItems
in the update request, in addition to the new order content.
In the following example, Item #1 from the above order is captured, and we add a third item to the order: