diff --git a/payment/uc_payment/css/uc_payment.css b/payment/uc_payment/css/uc_payment.css
index 4a54166..8b7a416 100644
--- a/payment/uc_payment/css/uc_payment.css
+++ b/payment/uc_payment/css/uc_payment.css
@@ -61,22 +61,13 @@ img.uc-2checkout-logo {
   left: 2.2em;
 }
 
-#line-items-div {
-  border: 1px solid #bbb;
+.uc-payment-totals {
   float: right;
-  margin: 0 0 1em 1em;
-}
-
-#line-items-div table {
-  margin: 0;
+  margin-left: 1em;
   width: auto;
 }
 
-#line-items-div td {
-  padding: 0.2em 0.5em;
-}
-
-#line-items-div td.title {
+.uc-payment-totals td.title {
   font-weight: bold;
 }
 
diff --git a/payment/uc_payment/lib/Drupal/uc_payment/Plugin/Ubercart/CheckoutPane/PaymentMethodPane.php b/payment/uc_payment/lib/Drupal/uc_payment/Plugin/Ubercart/CheckoutPane/PaymentMethodPane.php
index cb64751..d4b83cf 100644
--- a/payment/uc_payment/lib/Drupal/uc_payment/Plugin/Ubercart/CheckoutPane/PaymentMethodPane.php
+++ b/payment/uc_payment/lib/Drupal/uc_payment/Plugin/Ubercart/CheckoutPane/PaymentMethodPane.php
@@ -69,8 +69,6 @@ class PaymentMethodPane extends CheckoutPanePluginBase implements ContainerFacto
       $contents['line_items'] = array(
         '#theme' => 'uc_payment_totals',
         '#order' => $order,
-        '#prefix' => '<div id="line-items-div">',
-        '#suffix' => '</div>',
         '#weight' => -20,
       );
     }
diff --git a/payment/uc_payment/templates/uc-payment-totals.html.twig b/payment/uc_payment/templates/uc-payment-totals.html.twig
new file mode 100644
index 0000000..d99e574
--- /dev/null
+++ b/payment/uc_payment/templates/uc-payment-totals.html.twig
@@ -0,0 +1,25 @@
+{#
+/**
+ * @file
+ * Default theme implementation to display a summary of line items.
+ *
+ * Available variables:
+ * - order: The order that is being displayed.
+ * - line_items: An associative array of line items containing:
+ *   - type: Line item type.
+ *   - title: Line item title.
+ *   - amount: Line item price.
+ *   - attributes: HTML attributes to apply to the line item.
+ *
+ * @see template_preprocess_uc_payment_totals()
+ *
+ * @ingroup themeable
+#}
+<table class="uc-payment-totals">
+  {% for line in line_items %}
+    <tr {{ line.attributes }}>
+      <td class="title">{{ line.title }}</td>
+      <td class="price">{{ line.amount }}</td>
+    </tr>
+  {% endfor %}
+</table>
diff --git a/payment/uc_payment/uc_payment.module b/payment/uc_payment/uc_payment.module
index 3ff3e6e..f6b10a9 100644
--- a/payment/uc_payment/uc_payment.module
+++ b/payment/uc_payment/uc_payment.module
@@ -54,12 +54,27 @@ function uc_payment_theme() {
   return array(
     'uc_payment_totals' => array(
       'variables' => array('order' => NULL),
-      'file' => 'uc_payment.theme.inc',
+      'template' => 'uc-payment-totals',
     ),
   );
 }
 
 /**
+ * Prepares variables for the payment totals template.
+ *
+ * Default template: uc-payment-totals.html.twig.
+ */
+function template_preprocess_uc_payment_totals(&$variables) {
+  $variables['line_items'] = uc_order_load_line_items_display($variables['order']);
+
+  foreach ($variables['line_items'] as $key => $line) {
+    $variables['line_items'][$key]['attributes']['class'][] = 'line-item-' . $line['type'];
+    $variables['line_items'][$key]['title'] = filter_xss($line['title']);
+    $variables['line_items'][$key]['amount'] = theme('uc_price', array('price' => $line['amount']));
+  }
+}
+
+/**
  * Implements hook_form_FORM_ID_alter() for uc_cart_view_form().
  *
  * Adds express buttons for enabled payment modules directly to the cart page.
diff --git a/payment/uc_payment/uc_payment.theme.inc b/payment/uc_payment/uc_payment.theme.inc
deleted file mode 100644
index 2d0d560..0000000
--- a/payment/uc_payment/uc_payment.theme.inc
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * @file
- * Theme functions for the uc_payment module.
- */
-
-use Drupal\Core\Template\Attribute;
-
-/**
- * Generates markup for payment totals.
- *
- * @ingroup themeable
- */
-function theme_uc_payment_totals($variables) {
-  $order = $variables['order'];
-  $line_items = uc_order_load_line_items_display($order);
-
-  $output = '<table id="uc-order-total-preview">';
-
-  foreach ($line_items as $line) {
-    if (!empty($line['title'])) {
-      $attributes = new Attribute(array('class' => array('line-item-' . $line['type'])));
-      $output .= '<tr' . $attributes . '><td class="title">' . filter_xss($line['title']) . ':</td>'
-        . '<td class="price">' . theme('uc_price', array('price' => $line['amount'])) . '</td></tr>';
-    }
-  }
-
-  $output .= '</table>';
-
-  return $output;
-}
