---
title: "Specifying invoice lines and discounts"
description: "Include information about purchased items in your API requests and apply discounts."
url: "https://docs.adyen.com/payment-methods/klarna/invoice-lines"
source_url: "https://docs.adyen.com/payment-methods/klarna/invoice-lines.md"
canonical: "https://docs.adyen.com/payment-methods/klarna/invoice-lines"
last_modified: "2025-09-04T08:51:00+02:00"
language: "en"
---

# Specifying invoice lines and discounts

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

[View source](/payment-methods/klarna/invoice-lines.md)

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

* [Making a payment request](#payment-request).
* [Making a partial capture request](#partial-capture).
* [Making a partial refund request](#partial-refund).
* [Applying a discount](#discount-lines).
* [Adjusting an authorization](#adjust-auth).

## Make a payment request

For any payment request, include price and product information in [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-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`.

| lineItems                                                                                                                              | Required                                                                                    | Description                                                           |
| -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| [lineItems.quantity](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-quantity)                     | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The number of items.                                                  |
| [lineItems.amountExcludingTax](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-amountExcludingTax) |                                                                                             | The price for one item, without the tax, in minor units.              |
| [lineItems.taxPercentage](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-taxPercentage)           |                                                                                             | The tax percentage, in minor units.                                   |
| [lineItems.description](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-description)               | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The description of the line item.                                     |
| [lineItems.id](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-id)                                 |                                                                                             | The ID of the line item.                                              |
| [lineItems.taxAmount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-taxAmount)                   |                                                                                             | The tax amount for one item, in minor units.                          |
| [lineItems.amountIncludingTax](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-amountIncludingTax) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The price for one item, with the tax amount included, in minor units. |
| [lineItems.productUrl](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-productUrl)                 |                                                                                             | Link to the purchased item.                                           |
| [lineItems.imageUrl](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-imageUrl)                     |                                                                                             | Link to the picture of the purchased item.                            |

**Line items in a payments request**

```json
{
   "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"
      }
   ]
...
}
```

## Make a partial capture request

Include the following `lineItems` parameters when making a [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request.

| lineItems                                                                                                                              | Required                                                                                    | Description                                              |
| -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| [lineItems.quantity](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-quantity)                     | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The number of items.                                     |
| [lineItems.amountExcludingTax](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-amountExcludingTax) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The price for one item, without the tax, in minor units. |
| [lineItems.taxPercentage](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-taxPercentage)           | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The tax percentage, in minor units.                      |
| [lineItems.taxAmount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-taxAmount)                   |                                                                                             | The tax amount for one item, in minor units.             |
| [lineItems.description](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-description)               | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The description of the line item.                        |

**Line items in partial capture request**

```bash
curl https://checkout-test.adyen.com/v72/payments/{paymentPspReference}/captures \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
  "reference": "YOUR_CAPTURE_REFERENCE",
  "amount": {
    "value": "7400",
    "currency": "EUR"
  },
  "merchantAccount": "ADYEN_MERCHANT_ACCOUNT",
  "lineItems": [
    {
      "quantity": "1",
      "amountExcludingTax": "3058",
      "taxPercentage": "2100",
      "taxAmount": "642",
      "description": "Socks",
      "id": "Item #1",
      "amountIncludingTax": "3700",
      "productUrl": "URL_TO_PURCHASED_ITEM",
      "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
    },
    {
      "quantity": "1",
      "amountExcludingTax": "3058",
      "taxPercentage": "2100",
      "taxAmount": "642",
      "description": "Shoes",
      "id": "Item #1",
      "amountIncludingTax": "3700",
      "productUrl": "URL_TO_PURCHASED_ITEM",
      "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
    }
  ]
}'
```

You will receive a response containing a `pspReference`. Once we have processed your request, you will also receive a [CAPTURE](https://docs.adyen.com/api-explorer/Webhooks/latest/post/CAPTURE) webhook.

## Make a partial refund request

Include the following `lineItems` parameters when making a POST request to the [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) endpoint, where `paymentPspReference` is the `pspReference` of the authorization you want to refund.

| lineItems                                                                                                                              | Required                                                                                    | Description                                              |
| -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| [lineItems.quantity](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-quantity)                     | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The number of items.                                     |
| [lineItems.amountExcludingTax](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-amountExcludingTax) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The price for one item, without the tax, in minor units. |
| [lineItems.taxPercentage](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-taxPercentage)           | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The tax percentage, in minor units.                      |
| [lineItems.taxAmount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-taxAmount)                   |                                                                                             | The tax amount for one item, in minor units.             |
| [lineItems.description](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems-description)               | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The description of the line item.                        |

**Line items in partial refund request**

```bash
curl https://checkout-test.adyen.com/v72/payments/{paymentPspReference}/refunds \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
  "reference": "YOUR_REFUND_REFERENCE",
  "amount": {
    "value": "7400",
    "currency": "EUR"
  },
  "merchantAccount": "ADYEN_MERCHANT_ACCOUNT",
  "lineItems": [
    {
      "quantity": "1",
      "amountExcludingTax": "3058",
      "taxPercentage": "2100",
      "taxAmount": "642",
      "description": "Socks",
      "id": "Item #1",
      "amountIncludingTax": "3700",
      "productUrl": "URL_TO_PURCHASED_ITEM",
      "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
    },
    {
      "quantity": "1",
      "amountExcludingTax": "3058",
      "taxPercentage": "2100",
      "taxAmount": "642",
      "description": "Shoes",
      "id": "Item #1",
      "amountIncludingTax": "3700",
      "productUrl": "URL_TO_PURCHASED_ITEM",
      "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
    }
  ]
}'
```

You will receive a response containing a `pspReference`. Once we have processed your request, you will also receive a [REFUND](https://docs.adyen.com/api-explorer/Webhooks/latest/post/REFUND) webhook.

## Apply a discount

There are several ways to apply a discount to the invoice:

* [Apply a discount to individual line items](#discounted-amounts).
* [Apply a discount to the whole purchase](#discount-line-incl-vat).
* [Let Adyen add a discount line for you](#no-discount-line). 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:

1. Calculate the reduced amount of each line item you want to discount.

2. 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 discount to individual line items**

```json
{
  "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.

To apply a discount to the entire basket:

1. Calculate the discount to the product total and the VAT.

2. In your payments request, send each fully priced line item, plus a line Item to specify the discount with the following parameters:

   * `id`: **Discount**
   * `description`: **Discount**
   * `amountExcludingTax`: The discount amount, preceded by a minus sign
   * `taxAmount`: The discount amount, preceded by a minus sign
   * `amountIncludingTax`: 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    |                  |           |                   |

**Apply discount to entire purchase**

```json
{
  "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"
    },
    // The following line item specifies the discount
    {
      "quantity" : "1",
      "amountExcludingTax" : "-525",
      "taxPercentage" : "2000",
      "description" : "Discount",
      "id" : "Discount",
      "taxAmount" : "-105",
      "amountIncludingTax" : "-630"
    }
  ]
}
```

### 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.

**Adyen applies discount line**

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

## 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](/online-payments/adjust-authorisation/adjust-with-preauth) for detailed instructions. This is available for Klarna with Checkout API v70 and later.

Below are two examples of adjusting an authorized payment:

* [Cancel part of the authorization before capture](#cancel-before-capture)
* [Add a new product to a partially captured order](#add-product-partial-capture)

These examples are based on the following order:

#### curl

```bash
curl https://checkout-test.adyen.com/v70/sessions \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
  "merchantAccount": "ADYEN_MERCHANT_ACCOUNT",
  "reference": "YOUR_ORDER_REFERENCE",
  "amount": {
    "currency": "SEK",
    "value": 1000
  },
  "shopperLocale": "en_US",
  "countryCode": "SE",
  "telephoneNumber": "+46 840 839 298",
  "shopperEmail": "youremail@email.com",
  "shopperName": {
    "firstName": "Testperson-se",
    "lastName": "Approved"
  },
  "shopperReference": "YOUR_UNIQUE_SHOPPER_ID",
  "billingAddress": {
    "city": "Ankeborg",
    "country": "SE",
    "houseNumberOrName": "1",
    "postalCode": "12345",
    "street": "Stargatan"
  },
  "deliveryAddress": {
    "city": "Ankeborg",
    "country": "SE",
    "houseNumberOrName": "1",
    "postalCode": "12345",
    "street": "Stargatan"
  },
  "dateOfBirth": "1996-09-04",
  "socialSecurityNumber": "0108",
  "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..",
  "lineItems": [
    {
      "quantity": "1",
      "taxPercentage": "2100",
      "description": "Shoes",
      "id": "Item #1",
      "amountIncludingTax": "400",
      "productUrl": "URL_TO_PURCHASED_ITEM",
      "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
    },
    {
      "quantity": "2",
      "taxPercentage": "2100",
      "description": "Socks",
      "id": "Item #2",
      "amountIncludingTax": "300",
      "productUrl": "URL_TO_PURCHASED_ITEM",
      "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
    }
  ]
}'
```

#### Java

```java
// Adyen Java API Library v27.0.0
import com.adyen.Client;
import com.adyen.enums.Environment;
import com.adyen.model.checkout.*;
import java.time.OffsetDateTime;
import java.util.*;
import com.adyen.model.RequestOptions;
import com.adyen.service.checkout.*;

// For the live environment, additionally include your liveEndpointUrlPrefix.
Client client = new Client("ADYEN_API_KEY", Environment.TEST);

// Create the request object(s)
Amount amount = new Amount()
  .currency("SEK")
  .value(1000L);

LineItem lineItem1 = new LineItem()
  .quantity(1L)
  .taxPercentage(2100L)
  .imageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM")
  .description("Shoes")
  .id("Item #1")
  .amountIncludingTax(400L)
  .productUrl("URL_TO_PURCHASED_ITEM");

LineItem lineItem2 = new LineItem()
  .quantity(2L)
  .taxPercentage(2100L)
  .imageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM")
  .description("Socks")
  .id("Item #2")
  .amountIncludingTax(300L)
  .productUrl("URL_TO_PURCHASED_ITEM");

Name name = new Name()
  .firstName("Testperson-se")
  .lastName("Approved");

DeliveryAddress deliveryAddress = new DeliveryAddress()
  .country("SE")
  .city("Ankeborg")
  .houseNumberOrName("1")
  .street("Stargatan")
  .postalCode("12345");

BillingAddress billingAddress = new BillingAddress()
  .country("SE")
  .city("Ankeborg")
  .houseNumberOrName("1")
  .street("Stargatan")
  .postalCode("12345");

CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest()
  .amount(amount)
  .telephoneNumber("+46 840 839 298")
  .socialSecurityNumber("0108")
  .shopperEmail("youremail@email.com")
  .reference("YOUR_ORDER_REFERENCE")
  .lineItems(Arrays.asList(lineItem1, lineItem2))
  .shopperName(name)
  .merchantAccount("ADYEN_MERCHANT_ACCOUNT")
  .deliveryAddress(deliveryAddress)
  .countryCode("SE")
  .shopperLocale("en_US")
  .billingAddress(billingAddress)
  .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..")
  .shopperReference("YOUR_UNIQUE_SHOPPER_ID");

// Send the request
PaymentsApi service = new PaymentsApi(client);
CreateCheckoutSessionResponse response = service.sessions(createCheckoutSessionRequest, new RequestOptions().idempotencyKey("UUID"));
```

#### PHP

```php
// Adyen PHP API Library v19.0.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\LineItem;
use Adyen\Model\Checkout\Name;
use Adyen\Model\Checkout\DeliveryAddress;
use Adyen\Model\Checkout\BillingAddress;
use Adyen\Model\Checkout\CreateCheckoutSessionRequest;
use Adyen\Service\Checkout\PaymentsApi;

$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
// For the live environment, additionally include your liveEndpointUrlPrefix.
$client->setEnvironment(Environment::TEST);

// Create the request object(s)
$amount = new Amount();
$amount
  ->setCurrency("SEK")
  ->setValue(1000);

$lineItem1 = new LineItem();
$lineItem1
  ->setQuantity(1)
  ->setTaxPercentage(2100)
  ->setImageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM")
  ->setDescription("Shoes")
  ->setId("Item #1")
  ->setAmountIncludingTax(400)
  ->setProductUrl("URL_TO_PURCHASED_ITEM");

$lineItem2 = new LineItem();
$lineItem2
  ->setQuantity(2)
  ->setTaxPercentage(2100)
  ->setImageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM")
  ->setDescription("Socks")
  ->setId("Item #2")
  ->setAmountIncludingTax(300)
  ->setProductUrl("URL_TO_PURCHASED_ITEM");

$name = new Name();
$name
  ->setFirstName("Testperson-se")
  ->setLastName("Approved");

$deliveryAddress = new DeliveryAddress();
$deliveryAddress
  ->setCountry("SE")
  ->setCity("Ankeborg")
  ->setHouseNumberOrName("1")
  ->setStreet("Stargatan")
  ->setPostalCode("12345");

$billingAddress = new BillingAddress();
$billingAddress
  ->setCountry("SE")
  ->setCity("Ankeborg")
  ->setHouseNumberOrName("1")
  ->setStreet("Stargatan")
  ->setPostalCode("12345");

$createCheckoutSessionRequest = new CreateCheckoutSessionRequest();
$createCheckoutSessionRequest
  ->setAmount($amount)
  ->setTelephoneNumber("+46 840 839 298")
  ->setSocialSecurityNumber("0108")
  ->setShopperEmail("youremail@email.com")
  ->setReference("YOUR_ORDER_REFERENCE")
  ->setLineItems(array($lineItem1, $lineItem2))
  ->setShopperName($name)
  ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT")
  ->setDeliveryAddress($deliveryAddress)
  ->setCountryCode("SE")
  ->setShopperLocale("en_US")
  ->setBillingAddress($billingAddress)
  ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..")
  ->setShopperReference("YOUR_UNIQUE_SHOPPER_ID");

$requestOptions['idempotencyKey'] = 'UUID';

// Send the request
$service = new PaymentsApi($client);
$response = $service->sessions($createCheckoutSessionRequest, $requestOptions);
```

#### C\#

```cs
// Adyen .net API Library v17.0.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;

// For the live environment, additionally include your liveEndpointUrlPrefix.
var config = new Config()
{
    XApiKey = "ADYEN_API_KEY",
    Environment = Environment.Test
};
var client = new Client(config);

// Create the request object(s)
Amount amount = new Amount
{
  Currency = "SEK",
  Value = 1000
};

LineItem lineItem1 = new LineItem
{
  Quantity = 1,
  TaxPercentage = 2100,
  ImageUrl = "URL_TO_PICTURE_OF_PURCHASED_ITEM",
  Description = "Shoes",
  Id = "Item #1",
  AmountIncludingTax = 400,
  ProductUrl = "URL_TO_PURCHASED_ITEM"
};

LineItem lineItem2 = new LineItem
{
  Quantity = 2,
  TaxPercentage = 2100,
  ImageUrl = "URL_TO_PICTURE_OF_PURCHASED_ITEM",
  Description = "Socks",
  Id = "Item #2",
  AmountIncludingTax = 300,
  ProductUrl = "URL_TO_PURCHASED_ITEM"
};

Name name = new Name
{
  FirstName = "Testperson-se",
  LastName = "Approved"
};

DeliveryAddress deliveryAddress = new DeliveryAddress
{
  Country = "SE",
  City = "Ankeborg",
  HouseNumberOrName = "1",
  Street = "Stargatan",
  PostalCode = "12345"
};

BillingAddress billingAddress = new BillingAddress
{
  Country = "SE",
  City = "Ankeborg",
  HouseNumberOrName = "1",
  Street = "Stargatan",
  PostalCode = "12345"
};

CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest
{
  Amount = amount,
  TelephoneNumber = "+46 840 839 298",
  SocialSecurityNumber = "0108",
  ShopperEmail = "youremail@email.com",
  Reference = "YOUR_ORDER_REFERENCE",
  LineItems = new List<LineItem>{ lineItem1, lineItem2 },
  ShopperName = name,
  MerchantAccount = "ADYEN_MERCHANT_ACCOUNT",
  DeliveryAddress = deliveryAddress,
  CountryCode = "SE",
  ShopperLocale = "en_US",
  BillingAddress = billingAddress,
  AdditionalData = new Dictionary<string, string>
  ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy..",
  ShopperReference = "YOUR_UNIQUE_SHOPPER_ID"
};

// Send the request
var service = new PaymentsService(client);
var response = service.Sessions(createCheckoutSessionRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
```

#### NodeJS (JavaScript)

```js
// Adyen Node API Library v16.1.0
// Require the parts of the module you want to use
const { Client, CheckoutAPI } = require('@adyen/api-library');

// Initialize the client object
const client = new Client({apiKey: "YOUR_X_API_KEY", environment: "TEST"});

// Create the request object
const createCheckoutSessionRequest = {
  merchantAccount: "YOUR_MERCHANT_ACCOUNT",
  reference: "YOUR_ORDER_REFERENCE",
  amount: {
    currency: "SEK",
    value: 1000
  },
  shopperLocale: "en_US",
  countryCode: "SE",
  telephoneNumber: "+46 840 839 298",
  shopperEmail: "youremail@email.com",
  shopperName: {
    firstName: "Testperson-se",
    lastName: "Approved"
  },
  shopperReference: "YOUR_UNIQUE_SHOPPER_ID",
  billingAddress: {
    city: "Ankeborg",
    country: "SE",
    houseNumberOrName: "1",
    postalCode: "12345",
    street: "Stargatan"
  },
  deliveryAddress: {
    city: "Ankeborg",
    country: "SE",
    houseNumberOrName: "1",
    postalCode: "12345",
    street: "Stargatan"
  },
  dateOfBirth: new Date("1996-09-04"),
  socialSecurityNumber: "0108",
  returnUrl: "",
  lineItems: [ {
    quantity: "1",
    taxPercentage: "2100",
    description: "Shoes",
    id: "Item #1",
    amountIncludingTax: "400",
    productUrl: "URL_TO_PURCHASED_ITEM",
    imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM"
  }, {
    quantity: "2",
    taxPercentage: "2100",
    description: "Socks",
    id: "Item #2",
    amountIncludingTax: "300",
    productUrl: "URL_TO_PURCHASED_ITEM",
    imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM"
  } ]
}

// Make the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" });
```

#### Go

```go
// Adyen Go API Library v10.4.0
import (
  "context"
  "github.com/adyen/adyen-go-api-library/v9/src/common"
  "github.com/adyen/adyen-go-api-library/v9/src/adyen"
  "github.com/adyen/adyen-go-api-library/v9/src/checkout"
)
// For the live environment, additionally include your liveEndpointUrlPrefix.
client := adyen.NewClient(&common.Config{
  ApiKey:      "ADYEN_API_KEY",
  Environment: common.TestEnv,
})

// Create the request object(s)
amount := checkout.Amount{
  Currency: "SEK",
  Value: 1000,
}

lineItem1 := checkout.LineItem{
  Quantity: common.PtrInt64(1),
  TaxPercentage: common.PtrInt64(2100),
  ImageUrl: common.PtrString("URL_TO_PICTURE_OF_PURCHASED_ITEM"),
  Description: common.PtrString("Shoes"),
  Id: common.PtrString("Item #1"),
  AmountIncludingTax: common.PtrInt64(400),
  ProductUrl: common.PtrString("URL_TO_PURCHASED_ITEM"),
}

lineItem2 := checkout.LineItem{
  Quantity: common.PtrInt64(2),
  TaxPercentage: common.PtrInt64(2100),
  ImageUrl: common.PtrString("URL_TO_PICTURE_OF_PURCHASED_ITEM"),
  Description: common.PtrString("Socks"),
  Id: common.PtrString("Item #2"),
  AmountIncludingTax: common.PtrInt64(300),
  ProductUrl: common.PtrString("URL_TO_PURCHASED_ITEM"),
}

name := checkout.Name{
  FirstName: "Testperson-se",
  LastName: "Approved",
}

deliveryAddress := checkout.DeliveryAddress{
  Country: "SE",
  City: "Ankeborg",
  HouseNumberOrName: "1",
  Street: "Stargatan",
  PostalCode: "12345",
}

billingAddress := checkout.BillingAddress{
  Country: "SE",
  City: "Ankeborg",
  HouseNumberOrName: "1",
  Street: "Stargatan",
  PostalCode: "12345",
}

createCheckoutSessionRequest := checkout.CreateCheckoutSessionRequest{
  Amount: amount,
  TelephoneNumber: common.PtrString("+46 840 839 298"),
  SocialSecurityNumber: common.PtrString("0108"),
  ShopperEmail: common.PtrString("youremail@email.com"),
  Reference: "YOUR_ORDER_REFERENCE",
  LineItems: []checkout.LineItem{
      lineItem1, lineItem2,
  },
  ShopperName: &name,
  MerchantAccount: "ADYEN_MERCHANT_ACCOUNT",
  DeliveryAddress: &deliveryAddress,
  CountryCode: common.PtrString("SE"),
  ShopperLocale: common.PtrString("en_US"),
  BillingAddress: &billingAddress,
  ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..",
  ShopperReference: common.PtrString("YOUR_UNIQUE_SHOPPER_ID"),
}

// Send the request
service := client.Checkout()
req := service.PaymentsApi.SessionsInput().IdempotencyKey("UUID").CreateCheckoutSessionRequest(createCheckoutSessionRequest)
res, httpRes, err := service.PaymentsApi.Sessions(context.Background(), req)
```

#### Python

```py
# Adyen Python API Library v12.0.0
import Adyen

adyen = Adyen.Adyen()
adyen.client.xapikey = "YOUR_X_API_KEY"
adyen.client.platform = "test" # The environment to use library in.

json_request = {
  "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
  "reference": "YOUR_ORDER_REFERENCE",
  "amount": {
    "currency": "SEK",
    "value": 1000
  },
  "shopperLocale": "en_US",
  "countryCode": "SE",
  "telephoneNumber": "+46 840 839 298",
  "shopperEmail": "youremail@email.com",
  "shopperName": {
    "firstName": "Testperson-se",
    "lastName": "Approved"
  },
  "shopperReference": "YOUR_UNIQUE_SHOPPER_ID",
  "billingAddress": {
    "city": "Ankeborg",
    "country": "SE",
    "houseNumberOrName": "1",
    "postalCode": "12345",
    "street": "Stargatan"
  },
  "deliveryAddress": {
    "city": "Ankeborg",
    "country": "SE",
    "houseNumberOrName": "1",
    "postalCode": "12345",
    "street": "Stargatan"
  },
  "dateOfBirth": "1996-09-04",
  "socialSecurityNumber": "0108",
  "returnUrl": "",
  "lineItems": [ {
    "quantity": "1",
    "taxPercentage": "2100",
    "description": "Shoes",
    "id": "Item #1",
    "amountIncludingTax": "400",
    "productUrl": "URL_TO_PURCHASED_ITEM",
    "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
  }, {
    "quantity": "2",
    "taxPercentage": "2100",
    "description": "Socks",
    "id": "Item #2",
    "amountIncludingTax": "300",
    "productUrl": "URL_TO_PURCHASED_ITEM",
    "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
  } ]
}

result = adyen.checkout.payments_api.sessions(request=json_request, idempotency_key="UUID")
```

#### Ruby

```rb
# Adyen Ruby API Library v9.1.0
require "adyen-ruby-api-library"

adyen = Adyen::Client.new
adyen.api_key = 'YOUR_X_API_KEY'
adyen.env = :test # Set to "live" for live environment

request_body = {
  :merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
  :reference => 'YOUR_ORDER_REFERENCE',
  :amount => {
    :currency => 'SEK',
    :value => 1000
  },
  :shopperLocale => 'en_US',
  :countryCode => 'SE',
  :telephoneNumber => '+46 840 839 298',
  :shopperEmail => 'youremail@email.com',
  :shopperName => {
    :firstName => 'Testperson-se',
    :lastName => 'Approved'
  },
  :shopperReference => 'YOUR_UNIQUE_SHOPPER_ID',
  :billingAddress => {
    :city => 'Ankeborg',
    :country => 'SE',
    :houseNumberOrName => '1',
    :postalCode => '12345',
    :street => 'Stargatan'
  },
  :deliveryAddress => {
    :city => 'Ankeborg',
    :country => 'SE',
    :houseNumberOrName => '1',
    :postalCode => '12345',
    :street => 'Stargatan'
  },
  :dateOfBirth => '1996-09-04',
  :socialSecurityNumber => '0108',
  :returnUrl => '',
  :lineItems => [ {
    :quantity => '1',
    :taxPercentage => '2100',
    :description => 'Shoes',
    :id => 'Item #1',
    :amountIncludingTax => '400',
    :productUrl => 'URL_TO_PURCHASED_ITEM',
    :imageUrl => 'URL_TO_PICTURE_OF_PURCHASED_ITEM'
  }, {
    :quantity => '2',
    :taxPercentage => '2100',
    :description => 'Socks',
    :id => 'Item #2',
    :amountIncludingTax => '300',
    :productUrl => 'URL_TO_PURCHASED_ITEM',
    :imageUrl => 'URL_TO_PICTURE_OF_PURCHASED_ITEM'
  } ]
}

result = adyen.checkout.payments_api.sessions(request_body, headers: { 'Idempotency-Key' => 'UUID' })
```

#### NodeJS (TypeScript)

```ts
// Adyen Node API Library v18.0.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
// For the live environment, additionally include your liveEndpointUrlPrefix.
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

// Create the request object(s)
const amount: Types.checkout.Amount = {
  currency: "SEK",
  value: 1000
};

const lineItem1: Types.checkout.LineItem = {
  quantity: 1,
  taxPercentage: 2100,
  imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM",
  description: "Shoes",
  id: "Item #1",
  amountIncludingTax: 400,
  productUrl: "URL_TO_PURCHASED_ITEM"
};

const lineItem2: Types.checkout.LineItem = {
  quantity: 2,
  taxPercentage: 2100,
  imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM",
  description: "Socks",
  id: "Item #2",
  amountIncludingTax: 300,
  productUrl: "URL_TO_PURCHASED_ITEM"
};

const name: Types.checkout.Name = {
  firstName: "Testperson-se",
  lastName: "Approved"
};

const deliveryAddress: Types.checkout.DeliveryAddress = {
  country: "SE",
  city: "Ankeborg",
  houseNumberOrName: "1",
  street: "Stargatan",
  postalCode: "12345"
};

const billingAddress: Types.checkout.BillingAddress = {
  country: "SE",
  city: "Ankeborg",
  houseNumberOrName: "1",
  street: "Stargatan",
  postalCode: "12345"
};

const createCheckoutSessionRequest: Types.checkout.CreateCheckoutSessionRequest = {
  amount: amount,
  telephoneNumber: "+46 840 839 298",
  socialSecurityNumber: "0108",
  shopperEmail: "youremail@email.com",
  reference: "YOUR_ORDER_REFERENCE",
  lineItems: [lineItem1, lineItem2],
  shopperName: name,
  merchantAccount: "ADYEN_MERCHANT_ACCOUNT",
  deliveryAddress: deliveryAddress,
  countryCode: "SE",
  shopperLocale: "en_US",
  billingAddress: billingAddress,
  returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..",
  shopperReference: "YOUR_UNIQUE_SHOPPER_ID"
};

// Send the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" });
```

### 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](/payment-methods/klarna/invoice-lines#klarna-sessions) by declaring the new basket composition and amount.

**Cancel part of an auth before capture**

```json
curl https: //checkout-test.adyen.com/checkout/v72/payments/{paymentPspReference}/amountUpdates \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
    "merchantAccount": "ADYEN_MERCHANT_ACCOUNT",
    "amount": {
        "currency": "EUR",
        "value": 400
    },
    "lineItems": [
        {
            "quantity": "1",
            "taxPercentage": "2100",
            "description": "Shoes",
            "id": "Item #1",
            "amountIncludingTax": "400",
            "productUrl": "URL_TO_PURCHASED_ITEM",
            "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
        }
    ]
}'
```

### 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](/payment-methods/klarna/invoice-lines#klarna-sessions) is captured, and we add a third item to the order:

**Add product to partially captured order**

```json
curl https: //checkout-test.adyen.com/checkout/v72/payments/{paymentPspReference}/amountUpdates \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
    "merchantAccount": "ADYEN_MERCHANT_ACCOUNT",
    "amount": {
        "currency": "EUR",
        "value": 1300
    },
    "lineItems": [
        {
            "quantity": "1",
            "taxPercentage": "2100",
            "description": "Shoes",
            "id": "Item #1",
            "amountIncludingTax": "400",
            "productUrl": "URL_TO_PURCHASED_ITEM",
            "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
        },
        {
            "quantity": "2",
            "taxPercentage": "2100",
            "description": "Socks",
            "id": "Item #2",
            "amountIncludingTax": "300",
            "productUrl": "URL_TO_PURCHASED_ITEM",
            "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
        },
        {
            "quantity": "1",
            "taxPercentage": "2100",
            "description": "Hat",
            "id": "Item #3",
            "amountIncludingTax": "300",
            "productUrl": "URL_TO_PURCHASED_ITEM",
            "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM"
        }
    ]
}'
```
