Change record status: 
Project: 
Introduced in branch: 
8.x-2.x
Description: 

Line items no longer use the PaymentLineItemInfo and PaymentLineItem classes, and are no longer exposed using hook_payment_line_item_info().

Instead, contexts are Payment/LineItem plugins that need to implement \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface and can optionally extend \Drupal\payment\Plugin\Payment\LineItem\Base. Plugins should be annotated using \Drupal\payment\Annotations\PaymentLineItem. They can be set and got from payment entities using the \Drupal\payment\Plugin\Core\Entity\PaymentInterface::setLineItem*() and \Drupal\payment\Plugin\Core\Entity\PaymentInterface::getLineItem*() methods that are similar to their 7.x-1.x counterparts.

Line items no longer support tax rates and customizeable descriptions by default, although \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface::paymentDescription() must be implemented.

This change also introduced hook_payment_line_item_alter().

7.x-1.x

$line_item = new PaymentLineItem(array(
  'amount' => 5.46,
  'quantity' => 3,
);
$payment->setLineItem($line_item);

8.x-2.x

$manager = \Drupal\payment\Payment::lineItemManager();
$line_item = $manager->createInstance('payment_basic')
  ->setAmount(5.46)
  ->setQuantity(3);
$payment->setLineItem($line_item);
Impacts: 
Module developers