diff --git a/commerce_multi_payment.module b/commerce_multi_payment.module
index d67f4f4..fade367 100644
--- a/commerce_multi_payment.module
+++ b/commerce_multi_payment.module
@@ -1,5 +1,7 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\commerce_multi_payment\Hook\CommerceMultiPaymentHooks;
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
@@ -8,25 +10,17 @@ use Drupal\Core\Render\Element;
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function commerce_multi_payment_help($route_name, RouteMatchInterface $route_match) {
-  switch ($route_name) {
-    // Main module help for the commerce_multi_payment module.
-    case 'help.page.commerce_multi_payment':
-      $output = '';
-      $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('Allows multiple payments at checkout for supported payment gateways.') . '</p>';
-      return $output;
-
-    default:
-  }
+  return \Drupal::service(CommerceMultiPaymentHooks::class)->help($route_name, $route_match);
 }
 
 /**
  * Implements hook_entity_type_build().
  */
+#[LegacyHook]
 function commerce_multi_payment_entity_type_build(array &$entity_types) {
-  /** @var \Drupal\Core\Entity\ContentEntityType $commerce_payment */
-  $entity_types['commerce_payment']->setListBuilderClass('Drupal\commerce_multi_payment\PaymentListBuilder');
+  \Drupal::service(CommerceMultiPaymentHooks::class)->entityTypeBuild($entity_types);
 }
 
 function commerce_multi_payment_commerce_checkout_pane_info_alter(&$info) {
@@ -38,30 +32,17 @@ function commerce_multi_payment_commerce_checkout_pane_info_alter(&$info) {
 /**
  * Implements hook_entity_base_field_info().
  */
+#[LegacyHook]
 function commerce_multi_payment_entity_base_field_info(EntityTypeInterface $entity_type) {
-  if ($entity_type->id() == 'commerce_order') {
-    $fields['staged_multi_payment'] = BaseFieldDefinition::create('entity_reference')
-      ->setLabel(t('Staged Payments'))
-      ->setDescription(t('Multiple payments which are staged to be processed on the order.'))
-      ->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
-      ->setRequired(FALSE)
-      ->setSetting('target_type', 'commerce_staged_multi_payment')
-      ->setSetting('handler', 'default')
-      ->setTranslatable(FALSE);
-
-    return $fields;
-  }
+  return \Drupal::service(CommerceMultiPaymentHooks::class)->entityBaseFieldInfo($entity_type);
 }
 
 /**
  * Implements hook_theme().
  */
+#[LegacyHook]
 function commerce_multi_payment_theme() {
-  return [
-    'commerce_staged_multi_payment' => [
-      'render element' => 'elements',
-    ],
-  ];
+  return \Drupal::service(CommerceMultiPaymentHooks::class)->theme();
 }
 
 
diff --git a/commerce_multi_payment.services.yml b/commerce_multi_payment.services.yml
index eb4e8c2..dac4368 100644
--- a/commerce_multi_payment.services.yml
+++ b/commerce_multi_payment.services.yml
@@ -14,3 +14,7 @@ services:
       arguments: ['@current_user']
       tags:
         - { name: access_check, applies_to: _staged_payment_access }
+
+  Drupal\commerce_multi_payment\Hook\CommerceMultiPaymentHooks:
+    class: Drupal\commerce_multi_payment\Hook\CommerceMultiPaymentHooks
+    autowire: true
diff --git a/modules/multi_payment_example/commerce_multi_payment_example.module b/modules/multi_payment_example/commerce_multi_payment_example.module
index 063ef73..1de4ef5 100644
--- a/modules/multi_payment_example/commerce_multi_payment_example.module
+++ b/modules/multi_payment_example/commerce_multi_payment_example.module
@@ -1,20 +1,16 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\commerce_multi_payment_example\Hook\CommerceMultiPaymentExampleHooks;
+
 /**
  * @file
  * Contains commerce_multi_payment_example.module.
  */
-
 /**
  * Implements hook_theme().
  */
+#[LegacyHook]
 function commerce_multi_payment_example_theme() {
-  return [
-    'commerce_multi_payment_example_giftcard_form' => [
-      'render element' => 'form',
-    ],
-    'commerce_multi_payment_example_storecredit_form' => [
-      'render element' => 'form',
-    ],
-  ];
+  return \Drupal::service(CommerceMultiPaymentExampleHooks::class)->theme();
 }
diff --git a/modules/multi_payment_example/commerce_multi_payment_example.services.yml b/modules/multi_payment_example/commerce_multi_payment_example.services.yml
new file mode 100644
index 0000000..f3e8209
--- /dev/null
+++ b/modules/multi_payment_example/commerce_multi_payment_example.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\commerce_multi_payment_example\Hook\CommerceMultiPaymentExampleHooks:
+    class: Drupal\commerce_multi_payment_example\Hook\CommerceMultiPaymentExampleHooks
+    autowire: true
diff --git a/modules/multi_payment_example/src/Hook/CommerceMultiPaymentExampleHooks.php b/modules/multi_payment_example/src/Hook/CommerceMultiPaymentExampleHooks.php
new file mode 100644
index 0000000..5ca0024
--- /dev/null
+++ b/modules/multi_payment_example/src/Hook/CommerceMultiPaymentExampleHooks.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Drupal\commerce_multi_payment_example\Hook;
+
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for commerce_multi_payment_example.
+ */
+class CommerceMultiPaymentExampleHooks
+{
+    /**
+     * @file
+     * Contains commerce_multi_payment_example.module.
+     */
+    /**
+     * Implements hook_theme().
+     */
+    #[Hook('theme')]
+    public static function theme()
+    {
+        return [
+            'commerce_multi_payment_example_giftcard_form' => [
+                'render element' => 'form',
+            ],
+            'commerce_multi_payment_example_storecredit_form' => [
+                'render element' => 'form',
+            ],
+        ];
+    }
+}
diff --git a/modules/multi_payment_example/src/Plugin/Commerce/PaymentGateway/GiftCard.php b/modules/multi_payment_example/src/Plugin/Commerce/PaymentGateway/GiftCard.php
index 6def501..313cbf0 100644
--- a/modules/multi_payment_example/src/Plugin/Commerce/PaymentGateway/GiftCard.php
+++ b/modules/multi_payment_example/src/Plugin/Commerce/PaymentGateway/GiftCard.php
@@ -41,7 +41,7 @@ class GiftCard extends MultiplePaymentGatewayBase implements GiftCardPaymentGate
   /**
    * {@inheritdoc}
    */
-  public function capturePayment(PaymentInterface $payment, Price $amount = NULL) {
+  public function capturePayment(PaymentInterface $payment, ?Price $amount = NULL) {
     $this->assertPaymentState($payment, ['authorization']);
     // If not specified, capture the entire amount.
     $amount = $amount ?: $payment->getAmount();
@@ -66,7 +66,7 @@ class GiftCard extends MultiplePaymentGatewayBase implements GiftCardPaymentGate
   /**
    * {@inheritdoc}
    */
-  public function refundPayment(PaymentInterface $payment, Price $amount = NULL) {
+  public function refundPayment(PaymentInterface $payment, ?Price $amount = NULL) {
     $this->assertPaymentState($payment, ['completed', 'partially_refunded']);
     // If not specified, refund the entire amount.
     $amount = $amount ?: $payment->getAmount();
diff --git a/modules/multi_payment_example/src/Plugin/Commerce/PaymentGateway/StoreCredit.php b/modules/multi_payment_example/src/Plugin/Commerce/PaymentGateway/StoreCredit.php
index 924cd3e..989da01 100644
--- a/modules/multi_payment_example/src/Plugin/Commerce/PaymentGateway/StoreCredit.php
+++ b/modules/multi_payment_example/src/Plugin/Commerce/PaymentGateway/StoreCredit.php
@@ -43,7 +43,7 @@ class StoreCredit extends MultiplePaymentGatewayBase implements StoreCreditPayme
   /**
    * {@inheritdoc}
    */
-  public function refundPayment(PaymentInterface $payment, Price $amount = NULL) {
+  public function refundPayment(PaymentInterface $payment, ?Price $amount = NULL) {
     $this->assertPaymentState($payment, ['completed', 'partially_refunded']);
     // If not specified, refund the entire amount.
     $amount = $amount ?: $payment->getAmount();
diff --git a/src/Hook/CommerceMultiPaymentHooks.php b/src/Hook/CommerceMultiPaymentHooks.php
new file mode 100644
index 0000000..1ca801a
--- /dev/null
+++ b/src/Hook/CommerceMultiPaymentHooks.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace Drupal\commerce_multi_payment\Hook;
+
+use Drupal\Core\Field\BaseFieldDefinition;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Render\Element;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for commerce_multi_payment.
+ */
+class CommerceMultiPaymentHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_help().
+     */
+    #[Hook('help')]
+    public function help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match)
+    {
+        switch ($route_name) {
+            // Main module help for the commerce_multi_payment module.
+            case 'help.page.commerce_multi_payment':
+                $output = '';
+                $output .= '<h3>' . $this->t('About') . '</h3>';
+                $output .= '<p>' . $this->t('Allows multiple payments at checkout for supported payment gateways.') . '</p>';
+                return $output;
+            default:
+        }
+    }
+    /**
+     * Implements hook_entity_type_build().
+     */
+    #[Hook('entity_type_build')]
+    public static function entityTypeBuild(array &$entity_types)
+    {
+        /** @var \Drupal\Core\Entity\ContentEntityType $commerce_payment */
+        $entity_types['commerce_payment']->setListBuilderClass('Drupal\commerce_multi_payment\PaymentListBuilder');
+    }
+    /**
+     * Implements hook_entity_base_field_info().
+     */
+    #[Hook('entity_base_field_info')]
+    public function entityBaseFieldInfo(\Drupal\Core\Entity\EntityTypeInterface $entity_type)
+    {
+        if ($entity_type->id() == 'commerce_order') {
+            $fields['staged_multi_payment'] = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference')->setLabel($this->t('Staged Payments'))->setDescription($this->t('Multiple payments which are staged to be processed on the order.'))->setCardinality(\Drupal\Core\Field\BaseFieldDefinition::CARDINALITY_UNLIMITED)->setRequired(FALSE)->setSetting('target_type', 'commerce_staged_multi_payment')->setSetting('handler', 'default')->setTranslatable(FALSE);
+            return $fields;
+        }
+    }
+    /**
+     * Implements hook_theme().
+     */
+    #[Hook('theme')]
+    public static function theme()
+    {
+        return [
+            'commerce_staged_multi_payment' => [
+                'render element' => 'elements',
+            ],
+        ];
+    }
+}
diff --git a/src/Plugin/Commerce/CheckoutPane/ApplyPayment.php b/src/Plugin/Commerce/CheckoutPane/ApplyPayment.php
index c8792d3..2fd0f28 100644
--- a/src/Plugin/Commerce/CheckoutPane/ApplyPayment.php
+++ b/src/Plugin/Commerce/CheckoutPane/ApplyPayment.php
@@ -61,7 +61,7 @@ class ApplyPayment extends CheckoutPaneBase implements CheckoutPaneInterface {
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, CheckoutFlowInterface $checkout_flow = NULL) {
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?CheckoutFlowInterface $checkout_flow = NULL) {
     return new static(
       $configuration,
       $plugin_id,
