diff --git a/modules/payment_form/src/Entity/Payment/PaymentForm.php b/modules/payment_form/src/Entity/Payment/PaymentForm.php
index e2e90f2..e314e6f 100644
--- a/modules/payment_form/src/Entity/Payment/PaymentForm.php
+++ b/modules/payment_form/src/Entity/Payment/PaymentForm.php
@@ -81,7 +81,7 @@ class PaymentForm extends ContentEntityForm {
     $payment = $this->getEntity();
 
     $form['line_items'] = [
-      '#payment' => $payment,
+      '#payment_line_items' => $payment,
       '#type' => 'payment_line_items_display',
     ];
     $form['payment_method'] = $this->getPluginSelector($form_state)->buildSelectorForm([], $form_state);
diff --git a/src/Element/PaymentLineItemsDisplay.php b/src/Element/PaymentLineItemsDisplay.php
index f2ffa79..44106a6 100644
--- a/src/Element/PaymentLineItemsDisplay.php
+++ b/src/Element/PaymentLineItemsDisplay.php
@@ -12,8 +12,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Render\Element\FormElement;
 use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\currency\FormElementCallbackTrait;
-use Drupal\payment\Entity\PaymentInterface;
-use Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface;
+use Drupal\payment\LineItemCollectionInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -67,12 +66,8 @@ class PaymentLineItemsDisplay extends FormElement implements ContainerFactoryPlu
     $plugin_id = $this->getPluginId();
 
     return array(
-      // A \Drupal\payment\Entity\PaymentInterface instance (optional).
-      '#payment' => NULL,
-      // An array with
-      // \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface
-      // instances (required).
-      '#payment_line_items' => [],
+      // A \Drupal\payment\LineItemCollectionInterface instance (required).
+      '#payment_line_items' => NULL,
       '#pre_render' => [[get_class($this), 'instantiate#preRender#' . $plugin_id]],
     );
   }
@@ -83,11 +78,8 @@ class PaymentLineItemsDisplay extends FormElement implements ContainerFactoryPlu
    * @throws \InvalidArgumentException
    */
   public function preRender(array $element) {
-    if (!isset($element['#payment_line_items']) || !is_array($element['#payment_line_items'])) {
-      throw new \InvalidArgumentException('#payment_line_items must be an array of \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface instances.');
-    }
-    if (isset($element['#payment']) && !is_null($element['#payment']) && !($element['#payment'] instanceof PaymentInterface)) {
-      throw new \InvalidArgumentException('#payment must be NULL or implement \Drupal\payment\Entity\PaymentInterface.');
+    if (!isset($element['#payment_line_items']) || !($element['#payment_line_items'] instanceof LineItemCollectionInterface)) {
+      throw new \InvalidArgumentException(sprintf('#payment_line_items must be an instance of %s.', LineItemCollectionInterface::class));
     }
 
     $element['table'] = array(
@@ -96,12 +88,10 @@ class PaymentLineItemsDisplay extends FormElement implements ContainerFactoryPlu
       '#type' => 'table',
     );
 
-    /** @var \Drupal\payment\Plugin\Payment\Status\PaymentStatusInterface $status */
-    foreach ($element['#payment_line_items'] as $delta => $payment_line_item) {
-      if (!$payment_line_item instanceof PaymentLineItemInterface) {
-        $type = is_object($payment_line_item) ? get_class($payment_line_item) : gettype($payment_line_item);
-        throw new \InvalidArgumentException(sprintf('#payment_line_items must be an array of \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface instances, but the array contained %s.', $type));
-      }
+    /** @var \Drupal\payment\LineItemCollectionInterface $payment_line_items */
+    $payment_line_items = $element['#payment_line_items'];
+
+    foreach ($payment_line_items->getLineItems() as $delta => $payment_line_item) {
       /** @var \Drupal\currency\Entity\CurrencyInterface $currency */
       $currency = $this->currencyStorage->load($payment_line_item->getCurrencyCode());
       $element['table']['line_item_' . $payment_line_item->getName()] = array(
@@ -139,29 +129,26 @@ class PaymentLineItemsDisplay extends FormElement implements ContainerFactoryPlu
       );
     }
 
-    if (isset($element['#payment'])) {
-      /** @var \Drupal\payment\Entity\PaymentInterface $payment */
-      $payment = $element['#payment'];
-      $currency = $this->currencyStorage->load($payment->getCurrencyCode());
-      $element['table']['payment_total'] = array(
+    /** @var \Drupal\currency\Entity\CurrencyInterface $payment_line_items_currency */
+    $payment_line_items_currency = $this->currencyStorage->load($payment_line_items->getCurrencyCode());
+    $element['table']['payment_total'] = array(
+      '#attributes' => array(
+        'class' => array('payment-amount'),
+      ),
+      'label' => array(
         '#attributes' => array(
-          'class' => array('payment-amount'),
-        ),
-        'label' => array(
-          '#attributes' => array(
-            'class' => array('payment-amount-label'),
-            'colspan' => 3,
-          ),
-          '#markup' => $this->t('Total amount'),
+          'class' => array('payment-amount-label'),
+          'colspan' => 3,
         ),
-        'total' => array(
-          '#attributes' => array(
-            'class' => array('payment-amount-total'),
-          ),
-          '#markup' => $currency->formatAmount($payment->getAmount()),
+        '#markup' => $this->t('Total amount'),
+      ),
+      'total' => array(
+        '#attributes' => array(
+          'class' => array('payment-amount-total'),
         ),
-      );
-    }
+        '#markup' => $payment_line_items_currency->formatAmount($payment_line_items->getAmount()),
+      ),
+    );
 
     return $element;
   }
diff --git a/src/Element/PaymentReferenceBase.php b/src/Element/PaymentReferenceBase.php
index 7964782..e87c621 100644
--- a/src/Element/PaymentReferenceBase.php
+++ b/src/Element/PaymentReferenceBase.php
@@ -272,7 +272,7 @@ abstract class PaymentReferenceBase extends FormElement implements FormElementIn
     /** @var \Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface|null $selected_payment_method */
     $selected_payment_method = $plugin_selector->getSelectedPlugin();
     $build['line_items'] = array(
-      '#payment' => $this->getPayment($element, $form_state),
+      '#payment_line_items' => $this->getPayment($element, $form_state),
       '#type' => 'payment_line_items_display',
     );
     $build['payment_method'] = $plugin_selector->buildSelectorForm([], $form_state);
diff --git a/src/Entity/PaymentInterface.php b/src/Entity/PaymentInterface.php
index 414b586..b5f9ac7 100644
--- a/src/Entity/PaymentInterface.php
+++ b/src/Entity/PaymentInterface.php
@@ -9,7 +9,7 @@ namespace Drupal\payment\Entity;
 
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\EntityChangedInterface;
-use Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface;
+use Drupal\payment\LineItemCollectionInterface;
 use Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface as PluginPaymentMethodInterface;
 use Drupal\payment\Plugin\Payment\Status\PaymentStatusInterface as PluginPaymentStatusInterface;
 use Drupal\user\EntityOwnerInterface;
@@ -17,7 +17,7 @@ use Drupal\user\EntityOwnerInterface;
 /**
  * Defines a payment entity type .
  */
-interface PaymentInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
+interface PaymentInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface, LineItemCollectionInterface {
 
   /**
    * Executes the payment.
@@ -41,84 +41,6 @@ interface PaymentInterface extends ContentEntityInterface, EntityChangedInterfac
   public function getPaymentType();
 
   /**
-   * Gets the currency of the payment amount.
-   *
-   * @return \Drupal\currency\Entity\CurrencyInterface
-   */
-  public function getCurrency();
-
-  /**
-   * Sets the ISO 4217 currency code of the payment amount.
-   *
-   * @param string $currency_code
-   *
-   * @return \Drupal\payment\Entity\PaymentInterface
-   */
-  public function setCurrencyCode($currency_code);
-
-  /**
-   * Gets the ISO 4217 currency code of the payment amount.
-   *
-   * @return string
-   */
-  public function getCurrencyCode();
-
-  /**
-   * Sets line items.
-   *
-   * @param \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[] $line_items
-   *
-   * @return \Drupal\payment\Entity\PaymentInterface
-   */
-  public function setLineItems(array $line_items);
-
-  /**
-   * Sets a line item.
-   *
-   * @param \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface $line_item
-   *
-   * @return \Drupal\payment\Entity\PaymentInterface
-   */
-  public function setLineItem(PaymentLineItemInterface $line_item);
-
-  /**
-   * Unsets a line item.
-   *
-   * @param string $name
-   *   The line item's name.
-   *
-   * @return static
-   */
-  public function unsetLineItem($name);
-
-  /**
-   * Gets all line items.
-   *
-   * @return \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[]
-   */
-  public function getLineItems();
-
-  /**
-   * Gets a line item.
-   *
-   * @param string $name
-   *   The line item's machine name.
-   *
-   * @return \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface
-   */
-  public function getLineItem($name);
-
-  /**
-   * Gets line items by plugin type.
-   *
-   * @param string $plugin_id
-   *   The line item plugin's ID.
-   *
-   * @return \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[]
-   */
-  public function getLineItemsByType($plugin_id);
-
-  /**
    * Sets/replaces all statuses without notifications.
    *
    * @param \Drupal\payment\Plugin\Payment\Status\PaymentStatusInterface[] $payment_statuses
@@ -168,10 +90,9 @@ interface PaymentInterface extends ContentEntityInterface, EntityChangedInterfac
   public function setPaymentMethod(PluginPaymentMethodInterface $payment_method);
 
   /**
-   * Gets the payment amount.
+   * Gets the line items' currency.
    *
-   * @return float|int|string
-   *   A numeric value.
+   * @return \Drupal\currency\Entity\CurrencyInterface
    */
-  public function getAmount();
+  public function getCurrency();
 }
diff --git a/src/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationForm.php b/src/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationForm.php
index cec3ba7..1ba3e88 100644
--- a/src/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationForm.php
+++ b/src/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationForm.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\payment\Entity\PaymentMethodConfiguration;
 
+use Drupal\Component\Plugin\ConfigurablePluginInterface;
 use Drupal\Core\Entity\EntityForm;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
@@ -157,7 +158,7 @@ class PaymentMethodConfigurationForm extends EntityForm {
     $payment_method_configuration->setLabel($values['label']);
     $payment_method_configuration->setStatus($values['status']);
     $payment_method_configuration->setOwnerId($values['owner']);
-    $payment_method_configuration->setPluginConfiguration($payment_method_configuration_plugin->getConfiguration());
+    $payment_method_configuration->setPluginConfiguration($payment_method_configuration_plugin instanceof ConfigurablePluginInterface ? $payment_method_configuration_plugin->getConfiguration() : []);
   }
 
   /**
diff --git a/src/LineItemCollection.php b/src/LineItemCollection.php
new file mode 100644
index 0000000..6c4ce8d
--- /dev/null
+++ b/src/LineItemCollection.php
@@ -0,0 +1,137 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\payment\LineItemCollection.
+ */
+
+namespace Drupal\payment;
+
+use Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface;
+
+/**
+ * Provides a line item collection.
+ */
+class LineItemCollection implements LineItemCollectionInterface {
+
+  /**
+   * The line items' ISO 4217 currency code.
+   *
+   * @var string|null $currency_code
+   *   The currency code or NULL if the collection itself has no specific
+   *   currency.
+   */
+  protected $currencyCode;
+
+  /**
+   * The line items.
+   *
+   * @var \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[]
+   *   Keys are line item names.
+   */
+  protected $lineItems = [];
+
+  /**
+   * Constructs a new instance.
+   *
+   * @param string $currency_code
+   * @param \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[] $line_items
+   */
+  public function __construct($currency_code = NULL, array $line_items = []) {
+    $this->currencyCode = $currency_code;
+    $this->setLineItems($line_items);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setCurrencyCode($currency_code) {
+    $this->currencyCode = $currency_code;
+
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCurrencyCode() {
+    return $this->currencyCode;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setLineItems(array $line_items) {
+    $this->lineItems = [];
+    foreach ($line_items as $line_item) {
+      $this->setLineItem($line_item);
+    }
+
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setLineItem(PaymentLineItemInterface $line_item) {
+    $this->lineItems[$line_item->getName()] = $line_item;
+
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function unsetLineItem($name) {
+    unset($this->lineItems[$name]);
+
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getLineItems() {
+    return $this->lineItems;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getLineItem($name) {
+    $line_items = $this->getLineItems();
+    foreach ($line_items as $delta => $line_item) {
+      if ($line_item->getName() == $name) {
+        return $line_item;
+      }
+    }
+    return NULL;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getLineItemsByType($plugin_id) {
+    $line_items = [];
+    foreach ($this->getLineItems() as $name => $line_item) {
+      if ($line_item->getPluginId() == $plugin_id) {
+        $line_items[$name] = $line_item;
+      }
+    }
+
+    return $line_items;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getAmount() {
+    $total = 0;
+    foreach ($this->getLineItems() as $line_item) {
+      $total = bcadd($total, $line_item->getTotalAmount(), 6);
+    }
+
+    return $total;
+  }
+
+}
diff --git a/src/LineItemCollectionInterface.php b/src/LineItemCollectionInterface.php
new file mode 100644
index 0000000..1273df8
--- /dev/null
+++ b/src/LineItemCollectionInterface.php
@@ -0,0 +1,95 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\payment\LineItemCollectionInterface.
+ */
+
+namespace Drupal\payment;
+
+use Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface;
+
+/**
+ * Defines a line item collection.
+ */
+interface LineItemCollectionInterface {
+
+  /**
+   * Sets the line items' ISO 4217 currency code.
+   *
+   * @param string $currency_code
+   *
+   * @return static
+   */
+  public function setCurrencyCode($currency_code);
+
+  /**
+   * Gets the line items' ISO 4217 currency code.
+   *
+   * @return string
+   */
+  public function getCurrencyCode();
+
+  /**
+   * Sets line items.
+   *
+   * @param \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[] $line_items
+   *
+   * @return static
+   */
+  public function setLineItems(array $line_items);
+
+  /**
+   * Sets a line item.
+   *
+   * @param \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface $line_item
+   *
+   * @return static
+   */
+  public function setLineItem(PaymentLineItemInterface $line_item);
+
+  /**
+   * Unsets a line item.
+   *
+   * @param string $name
+   *   The line item's name.
+   *
+   * @return static
+   */
+  public function unsetLineItem($name);
+
+  /**
+   * Gets all line items.
+   *
+   * @return \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[]
+   */
+  public function getLineItems();
+
+  /**
+   * Gets a line item.
+   *
+   * @param string $name
+   *   The line item's machine name.
+   *
+   * @return \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface
+   */
+  public function getLineItem($name);
+
+  /**
+   * Gets line items by plugin type.
+   *
+   * @param string $plugin_id
+   *   The line item plugin's ID.
+   *
+   * @return \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[]
+   */
+  public function getLineItemsByType($plugin_id);
+
+  /**
+   * Gets the line items' total amount.
+   *
+   * @return float|int|string
+   *   A numeric value.
+   */
+  public function getAmount();
+}
diff --git a/src/Plugin/Field/FieldFormatter/PaymentLineItemOverview.php b/src/Plugin/Field/FieldFormatter/PaymentLineItemOverview.php
index 07459b2..c00518f 100644
--- a/src/Plugin/Field/FieldFormatter/PaymentLineItemOverview.php
+++ b/src/Plugin/Field/FieldFormatter/PaymentLineItemOverview.php
@@ -10,6 +10,7 @@ namespace Drupal\payment\Plugin\Field\FieldFormatter;
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\FormatterBase;
 use Drupal\payment\Entity\PaymentInterface;
+use Drupal\payment\LineItemCollection;
 
 /**
  * A payment line item field formatter.
@@ -28,13 +29,12 @@ class PaymentLineItemOverview extends FormatterBase {
    * {@inheritdoc}
    */
   public function viewElements(FieldItemListInterface $items) {
-    $payment_line_items = [];
+    $payment_line_items = new LineItemCollection();
     /** @var \Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemInterface $item */
     foreach ($items as $delta => $item) {
-      $payment_line_items[$delta] = $item->getContainedPluginInstance();
+      $payment_line_items->setLineItem($item->getContainedPluginInstance());
     }
     $build[0] = array(
-      '#payment' => $items->getEntity() instanceof PaymentInterface ? $items->getEntity() : NULL,
       '#payment_line_items' => $payment_line_items,
       '#type' => 'payment_line_items_display',
     );
diff --git a/tests/src/Unit/Element/PaymentLineItemsDisplayTest.php b/tests/src/Unit/Element/PaymentLineItemsDisplayTest.php
index 6a7caae..8b16556 100644
--- a/tests/src/Unit/Element/PaymentLineItemsDisplayTest.php
+++ b/tests/src/Unit/Element/PaymentLineItemsDisplayTest.php
@@ -12,6 +12,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\currency\Entity\CurrencyInterface;
 use Drupal\payment\Element\PaymentLineItemsDisplay;
 use Drupal\payment\Entity\PaymentInterface;
+use Drupal\payment\LineItemCollectionInterface;
 use Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -100,45 +101,48 @@ class PaymentLineItemsDisplayTest extends UnitTestCase {
    * @covers ::preRender
    */
   public function testPreRender() {
-    $line_item_amount = mt_rand();
-    $line_item_total_amount = mt_rand();
-    $line_item_currency_code = $this->randomMachineName();
-    $line_item = $this->getMock(PaymentLineItemInterface::class);
-    $line_item->expects($this->atLeastOnce())
+    $payment_line_item_amount = mt_rand();
+    $payment_line_item_total_amount = mt_rand();
+    $payment_line_item_currency_code = $this->randomMachineName();
+    $payment_line_item = $this->getMock(PaymentLineItemInterface::class);
+    $payment_line_item->expects($this->atLeastOnce())
       ->method('getAmount')
-      ->willReturn($line_item_amount);
-    $line_item->expects($this->atLeastOnce())
+      ->willReturn($payment_line_item_amount);
+    $payment_line_item->expects($this->atLeastOnce())
       ->method('getCurrencyCode')
-      ->willReturn($line_item_currency_code);
-    $line_item->expects($this->atLeastOnce())
+      ->willReturn($payment_line_item_currency_code);
+    $payment_line_item->expects($this->atLeastOnce())
       ->method('getTotalAmount')
-      ->willReturn($line_item_total_amount);
+      ->willReturn($payment_line_item_total_amount);
 
-    $payment_currency_code = $this->randomMachineName();
-    $payment = $this->getMock(PaymentInterface::class);
-    $payment->expects($this->atLeastOnce())
+    $payment_line_items_currency_code = $this->randomMachineName();
+
+    $payment_line_items = $this->getMock(LineItemCollectionInterface::class);
+    $payment_line_items->expects($this->atLeastOnce())
       ->method('getCurrencyCode')
-      ->willReturn($payment_currency_code);
+      ->willReturn($payment_line_items_currency_code);
+    $payment_line_items->expects($this->atLeastOnce())
+      ->method('getLineItems')
+      ->willReturn([$payment_line_item]);
 
-    $line_item_currency = $this->getMock(CurrencyInterface::class);
-    $line_item_currency->expects($this->exactly(2))
+    $payment_line_item_currency = $this->getMock(CurrencyInterface::class);
+    $payment_line_item_currency->expects($this->exactly(2))
       ->method('formatAmount');
 
-    $payment_currency = $this->getMock(CurrencyInterface::class);
-    $payment_currency->expects($this->once())
+    $payment_line_items_currency = $this->getMock(CurrencyInterface::class);
+    $payment_line_items_currency->expects($this->once())
       ->method('formatAmount');
 
     $map = array(
-      array($line_item_currency_code, $line_item_currency),
-      array($payment_currency_code, $payment_currency),
+      array($payment_line_item_currency_code, $payment_line_item_currency),
+      array($payment_line_items_currency_code, $payment_line_items_currency),
     );
-    $this->currencyStorage->expects($this->exactly(2))
+    $this->currencyStorage->expects($this->atLeast(count($map)))
       ->method('load')
       ->willReturnMap($map);
 
     $element = array(
-      '#payment' => $payment,
-      '#payment_line_items' => [$line_item],
+      '#payment_line_items' => $payment_line_items,
     );
 
     $build = $this->sut->preRender($element);
diff --git a/tests/src/Unit/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationFormTest.php b/tests/src/Unit/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationFormTest.php
index 1f7465e..d147cb5 100644
--- a/tests/src/Unit/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationFormTest.php
+++ b/tests/src/Unit/Entity/PaymentMethodConfiguration/PaymentMethodConfigurationFormTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\Tests\payment\Unit\Entity\PaymentMethodConfiguration {
 
+  use Drupal\Component\Plugin\ConfigurablePluginInterface;
   use Drupal\Core\Entity\EntityManagerInterface;
   use Drupal\Core\Entity\EntityStorageInterface;
   use Drupal\Core\Form\FormState;
@@ -290,7 +291,7 @@ namespace Drupal\Tests\payment\Unit\Entity\PaymentMethodConfiguration {
         ->method('id')
         ->willReturn($owner_id);
 
-      $plugin = $this->getMock(PaymentMethodConfigurationInterfacePlugin::class);
+      $plugin = $this->getMock(PaymentMethodConfigurationFormTestPlugin::class);
       $plugin->expects($this->atLeastOnce())
         ->method('getConfiguration')
         ->willReturn($plugin_configuration);
@@ -437,6 +438,13 @@ namespace Drupal\Tests\payment\Unit\Entity\PaymentMethodConfiguration {
 
   }
 
+  /**
+   * Provides a payment method configuration plugin that provides configuration.
+   */
+  interface PaymentMethodConfigurationFormTestPlugin extends PaymentMethodConfigurationInterfacePlugin, ConfigurablePluginInterface {
+
+  }
+
 }
 
 namespace {
diff --git a/tests/src/Unit/LineItemCollectionTest.php b/tests/src/Unit/LineItemCollectionTest.php
new file mode 100644
index 0000000..0a89a44
--- /dev/null
+++ b/tests/src/Unit/LineItemCollectionTest.php
@@ -0,0 +1,115 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\payment\Unit\LineItemCollectionTest.
+ */
+
+namespace Drupal\Tests\payment\Unit;
+
+use Drupal\payment\LineItemCollection;
+use Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\payment\LineItemCollection
+ *
+ * @group Payment
+ */
+class LineItemCollectionTest extends UnitTestCase {
+
+  /**
+   * The line items' ISO 4217 currency code.
+   *
+   * @var string|null $currency_code
+   *   The currency code or NULL if the collection itself has no specific
+   *   currency.
+   */
+  protected $currencyCode;
+
+  /**
+   * The line items.
+   *
+   * @var \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[]
+   *   Keys are line item names.
+   */
+  protected $lineItems = [];
+
+  /**
+   * The subject under test.
+   *
+   * @var \Drupal\payment\LineItemCollection
+   */
+  protected $sut;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    $this->currencyCode = $this->randomMachineName();
+
+    $line_item_name_a = $this->randomMachineName();
+    $line_item_a = $this->getMock(PaymentLineItemInterface::class);
+    $line_item_a->expects($this->atLeastOnce())
+      ->method('getName')
+      ->willReturn($line_item_name_a);
+    $line_item_name_b = $this->randomMachineName();
+    $line_item_b = $this->getMock(PaymentLineItemInterface::class);
+    $line_item_b->expects($this->atLeastOnce())
+      ->method('getName')
+      ->willReturn($line_item_name_b);
+
+    $this->lineItems = [
+      $line_item_name_a => $line_item_a,
+      $line_item_name_b => $line_item_b,
+    ];
+
+    $this->sut = new LineItemCollection($this->currencyCode, $this->lineItems);
+  }
+
+  /**
+   * @covers ::__construct
+   */
+  public function testConstruct() {
+    $this->sut = new LineItemCollection($this->currencyCode, $this->lineItems);
+  }
+
+  /**
+   * @covers ::getCurrencyCode
+   * @covers ::setCurrencyCode
+   */
+  public function testGetCurrencyCode() {
+    $this->assertSame($this->currencyCode, $this->sut->getCurrencyCode());
+
+    $currency_code = $this->randomMachineName();
+    $this->assertSame($this->sut, $this->sut->setCurrencyCode($currency_code));
+    $this->assertSame($currency_code, $this->sut->getCurrencyCode());
+  }
+
+  /**
+   * @covers ::getLineItem
+   * @covers ::setLineItem
+   * @covers ::unsetLineItem
+   */
+  public function testGetLineItem() {
+    foreach ($this->lineItems as $name => $line_item) {
+      $this->assertSame($line_item, $this->sut->getLineItem($name));
+    }
+
+    $line_item_name = $this->randomMachineName();
+    $line_item = $this->getMock(PaymentLineItemInterface::class);
+    $line_item->expects($this->atLeastOnce())
+      ->method('getName')
+      ->willReturn($line_item_name);
+
+    $this->assertSame($this->sut, $this->sut->setLineItem($line_item));
+    $this->assertSame($line_item, $this->sut->getLineItem($line_item_name));
+    $this->assertSame($this->sut, $this->sut->unsetLineItem($line_item_name));
+    $this->assertNull($this->sut->getLineItem($line_item_name));
+
+    foreach ($this->lineItems as $name => $line_item) {
+      $this->assertSame($line_item, $this->sut->getLineItem($name));
+    }
+  }
+
+}
