diff --git a/src/EventSubscriber/WebformPaystackFieldInitEventSubscriber.php b/src/EventSubscriber/WebformPaystackFieldInitEventSubscriber.php
index 36ebfd3..249aeb6 100644
--- a/src/EventSubscriber/WebformPaystackFieldInitEventSubscriber.php
+++ b/src/EventSubscriber/WebformPaystackFieldInitEventSubscriber.php
@@ -45,7 +45,7 @@ class WebformPaystackFieldInitEventSubscriber implements EventSubscriberInterfac
   /**
    * {@inheritdoc}
    */
-  public static function getSubscribedEvents() {
+  public static function getSubscribedEvents(): array {
 
     $events[KernelEvents::REQUEST][] = ['onWebformSubmit'];
 
diff --git a/src/Hook/WebformPaystackFieldHooks.php b/src/Hook/WebformPaystackFieldHooks.php
new file mode 100644
index 0000000..89119ff
--- /dev/null
+++ b/src/Hook/WebformPaystackFieldHooks.php
@@ -0,0 +1,70 @@
+<?php
+
+namespace Drupal\webform_paystack_field\Hook;
+
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Routing\TrustedRedirectResponse;
+use Yabacon\Paystack;
+use Yabacon\Paystack\Exception\ApiException as PaystackApiException;
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for webform_paystack_field.
+ */
+class WebformPaystackFieldHooks
+{
+    /**
+     * Implements hook_cron().
+     */
+    #[Hook('cron')]
+    public static function cron()
+    {
+        $arr_webform_trnx_fail_data = \Drupal::database()->select('webform_paystack_trnx', 't')->fields('t', [
+            'id',
+            'webform_object',
+        ])->isNull('webform_id')->condition('timestamp', time() - 1000 * 60 * 60 * 24 * 2, '>')->isNotNull('webform_object')->execute()->fetchAll();
+        foreach ($arr_webform_trnx_fail_data as $webform_trnx_fail_data) {
+            if ($webform_trnx_fail_data->id) {
+                try {
+                    $paystack = new \Yabacon\Paystack(\Drupal::config('webform_paystack_field.settings')->get('webform_paystack_field_private_key'));
+                    // Initialize a transaction for verify.
+                    $arrResponseObj[] = $paystack->transaction->verify([
+                        'reference' => $webform_trnx_fail_data->id,
+                    ]);
+                    $paystack = new \Yabacon\Paystack(\Drupal::config('webform_paystack_field.settings')->get('usd_webform_paystack_field_private_key'));
+                    // Initialize a transaction for verify.
+                    $arrResponseObj[] = $paystack->transaction->verify([
+                        'reference' => $webform_trnx_fail_data->id,
+                    ]);
+                } catch (\Yabacon\Paystack\Exception\ApiException $e) {
+                    if (str_contains($e->getMessage(), 'Transaction reference not found')) {
+                        \Drupal::database()->delete('webform_paystack_trnx')->condition('id', $webform_trnx_fail_data->id)->execute();
+                    }
+                    continue;
+                }
+                foreach ($arrResponseObj as $responseObj) {
+                    if ($responseObj->data->status == 'success') {
+                        $webform_object = unserialize($webform_trnx_fail_data->webform_object, [
+                            'allowed_classes' => FALSE,
+                        ]);
+                        if ($webform_object && $webform_object->getWebform()) {
+                            try {
+                                $webform_object->set('changed', time());
+                                $webform_object->save();
+                            } catch (\Yabacon\Paystack\Exception\ApiException $e) {
+                                continue;
+                            }
+                            \Drupal::database()->update('webform_paystack_data')->fields([
+                                'status' => 1,
+                                'trxref' => $webform_trnx_fail_data->id,
+                                'webform_id' => $webform_object->id(),
+                            ])->condition('reference', $webform_trnx_fail_data->id)->execute();
+                            \Drupal::database()->update('webform_paystack_trnx')->fields([
+                                'webform_id' => $webform_object->id(),
+                            ])->condition('id', $webform_trnx_fail_data->id)->execute();
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/src/Hook/WebformPaystackFieldViewsHooks.php b/src/Hook/WebformPaystackFieldViewsHooks.php
new file mode 100644
index 0000000..ac4a639
--- /dev/null
+++ b/src/Hook/WebformPaystackFieldViewsHooks.php
@@ -0,0 +1,180 @@
+<?php
+
+namespace Drupal\webform_paystack_field\Hook;
+
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for webform_paystack_field.
+ */
+class WebformPaystackFieldViewsHooks
+{
+    use StringTranslationTrait;
+    /**
+     * @file
+     * Views integration.
+     */
+    /**
+     * Implements hook_views_data().
+     */
+    #[Hook('views_data')]
+    public function viewsData()
+    {
+        $data['webform_paystack_data']['table']['group'] = $this->t('Webform Paystack Field');
+        $data['webform_paystack_data']['table']['base'] = [
+            'field' => 'reference',
+            'title' => $this->t('Webform Paystack Field'),
+            'help' => $this->t('Webform Paystack Field Data contains data related to paystack transaction related to webforms.'),
+            'weight' => -10,
+        ];
+        $data['webform_paystack_data']['table']['join'] = [
+            'webform_submission' => [
+                'left_field' => 'sid',
+                'field' => 'webform_id',
+            ],
+            'node_field_data' => [
+                'left_field' => 'nid',
+                'field' => 'nid',
+            ],
+        ];
+        $data['webform_paystack_data']['reference'] = [
+            'title' => $this->t('Paystack reference'),
+            'help' => $this->t('Paystack reference'),
+            'field' => [
+                'id' => 'standard',
+            ],
+            'sort' => [
+                'id' => 'standard',
+            ],
+            'filter' => [
+                'id' => 'string',
+            ],
+            'argument' => [
+                'id' => 'string',
+            ],
+        ];
+        $data['webform_paystack_data']['trxref'] = [
+            'title' => $this->t('Paystack transation reference'),
+            'help' => $this->t('Paystack transation reference'),
+            'field' => [
+                'id' => 'standard',
+            ],
+            'sort' => [
+                'id' => 'standard',
+            ],
+            'filter' => [
+                'id' => 'string',
+            ],
+            'argument' => [
+                'id' => 'string',
+            ],
+        ];
+        $data['webform_paystack_data']['email'] = [
+            'title' => $this->t('Email'),
+            'help' => $this->t('Email'),
+            'field' => [
+                'id' => 'standard',
+            ],
+            'sort' => [
+                'id' => 'standard',
+            ],
+            'filter' => [
+                'id' => 'string',
+            ],
+            'argument' => [
+                'id' => 'string',
+            ],
+        ];
+        $data['webform_paystack_data']['first_name'] = [
+            'title' => $this->t('First Name'),
+            'help' => $this->t('First Name'),
+            'field' => [
+                'id' => 'standard',
+            ],
+            'sort' => [
+                'id' => 'standard',
+            ],
+            'filter' => [
+                'id' => 'string',
+            ],
+            'argument' => [
+                'id' => 'string',
+            ],
+        ];
+        $data['webform_paystack_data']['last_name'] = [
+            'title' => $this->t('Last Name'),
+            'help' => $this->t('Last Name'),
+            'field' => [
+                'id' => 'standard',
+            ],
+            'sort' => [
+                'id' => 'standard',
+            ],
+            'filter' => [
+                'id' => 'string',
+            ],
+            'argument' => [
+                'id' => 'string',
+            ],
+        ];
+        $data['webform_paystack_data']['amount'] = [
+            'title' => $this->t('Amount'),
+            'help' => $this->t('Amount'),
+            'field' => [
+                'id' => 'numeric',
+            ],
+            'sort' => [
+                'id' => 'standard',
+            ],
+            'filter' => [
+                'id' => 'numeric',
+            ],
+            'argument' => [
+                'id' => 'numeric',
+            ],
+        ];
+        $data['webform_paystack_data']['webform_id'] = [
+            'title' => $this->t('Webform id'),
+            'help' => $this->t('Webform Submission'),
+            'relationship' => [
+                'base' => 'webform_submission',
+                'base field' => 'sid',
+                'id' => 'standard',
+                'label' => $this->t('Webform Submission'),
+            ],
+        ];
+        $data['webform_paystack_data']['status'] = [
+            'title' => $this->t('Transaction status'),
+            'help' => $this->t('Transaction status'),
+            'field' => [
+                'id' => 'numeric',
+            ],
+            'sort' => [
+                'id' => 'standard',
+            ],
+            'filter' => [
+                'id' => 'numeric',
+            ],
+            'argument' => [
+                'id' => 'numeric',
+            ],
+        ];
+        $data['webform_paystack_data']['private_key'] = [
+            'title' => $this->t('Paystack Private key'),
+            'help' => $this->t('Paystack Private key'),
+            'field' => [
+                'id' => 'standard',
+            ],
+            'sort' => [
+                'id' => 'standard',
+            ],
+            'filter' => [
+                'id' => 'string',
+            ],
+            'argument' => [
+                'id' => 'string',
+            ],
+        ];
+        return $data;
+    }
+}
diff --git a/webform_paystack_field.module b/webform_paystack_field.module
index ac7f5f6..33f368e 100644
--- a/webform_paystack_field.module
+++ b/webform_paystack_field.module
@@ -4,7 +4,8 @@
  * @file
  * Module file for webform paystack field.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\webform_paystack_field\Hook\WebformPaystackFieldHooks;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Routing\TrustedRedirectResponse;
 use Yabacon\Paystack;
@@ -111,68 +112,8 @@ function webform_paystack_field_webform_submission_presave(EntityInterface $enti
 /**
  * Implements hook_cron().
  */
-function webform_paystack_field_cron() {
-
-  $arr_webform_trnx_fail_data = \Drupal::database()->select('webform_paystack_trnx', 't')
-    ->fields('t', ['id', 'webform_object'])
-    ->isNull('webform_id')
-    ->condition('timestamp', time() - 1000 * 60 * 60 * 24 * 2, '>')
-    ->isNotNull('webform_object')
-    ->execute()
-    ->fetchAll();
-
-  foreach ($arr_webform_trnx_fail_data as $webform_trnx_fail_data) {
-    if ($webform_trnx_fail_data->id) {
-      try {
-        $paystack = new Paystack(\Drupal::config('webform_paystack_field.settings')->get('webform_paystack_field_private_key'));
-        // Initialize a transaction for verify.
-        $arrResponseObj[] = $paystack->transaction->verify([
-          'reference' => $webform_trnx_fail_data->id,
-        ]);
-
-        $paystack = new Paystack(\Drupal::config('webform_paystack_field.settings')->get('usd_webform_paystack_field_private_key'));
-        // Initialize a transaction for verify.
-        $arrResponseObj[] = $paystack->transaction->verify([
-          'reference' => $webform_trnx_fail_data->id,
-        ]);
-      }
-      catch (PaystackApiException $e) {
-        if (str_contains($e->getMessage(), 'Transaction reference not found')) {
-          \Drupal::database()->delete('webform_paystack_trnx')
-            ->condition('id', $webform_trnx_fail_data->id)
-            ->execute();
-        }
-        continue;
-      }
-
-      foreach ($arrResponseObj as $responseObj) {
-        if ($responseObj->data->status == 'success') {
-
-          $webform_object = unserialize($webform_trnx_fail_data->webform_object, ['allowed_classes' => FALSE]);
-
-          if ($webform_object && $webform_object->getWebform()) {
-
-            try {
-              $webform_object->set('changed', time());
-              $webform_object->save();
-            }
-            catch (PaystackApiException $e) {
-              continue;
-            }
-
-            \Drupal::database()->update('webform_paystack_data')
-              ->fields(['status' => 1, 'trxref' => $webform_trnx_fail_data->id, 'webform_id' => $webform_object->id()])
-              ->condition('reference', $webform_trnx_fail_data->id)
-              ->execute();
-
-            \Drupal::database()->update('webform_paystack_trnx')
-              ->fields(['webform_id' => $webform_object->id()])
-              ->condition('id', $webform_trnx_fail_data->id)
-              ->execute();
-          }
-        }
-      }
-    }
-  }
-
+#[LegacyHook]
+function webform_paystack_field_cron()
+{
+    \Drupal::service(WebformPaystackFieldHooks::class)->cron();
 }
diff --git a/webform_paystack_field.services.yml b/webform_paystack_field.services.yml
index 4444f09..b82a3d0 100644
--- a/webform_paystack_field.services.yml
+++ b/webform_paystack_field.services.yml
@@ -4,3 +4,11 @@ services:
     arguments: ["@config.factory", "@database"]
     tags:
       - { name: event_subscriber }
+
+  Drupal\webform_paystack_field\Hook\WebformPaystackFieldHooks:
+    class: Drupal\webform_paystack_field\Hook\WebformPaystackFieldHooks
+    autowire: true
+
+  Drupal\webform_paystack_field\Hook\WebformPaystackFieldViewsHooks:
+    class: Drupal\webform_paystack_field\Hook\WebformPaystackFieldViewsHooks
+    autowire: true
diff --git a/webform_paystack_field.views.inc b/webform_paystack_field.views.inc
index a19dfcd..1175801 100644
--- a/webform_paystack_field.views.inc
+++ b/webform_paystack_field.views.inc
@@ -1,170 +1,17 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\webform_paystack_field\Hook\WebformPaystackFieldViewsHooks;
+
 /**
  * @file
  * Views integration.
  */
-
 /**
  * Implements hook_views_data().
  */
-function webform_paystack_field_views_data() {
-
-  $data['webform_paystack_data']['table']['group'] = t('Webform Paystack Field');
-  $data['webform_paystack_data']['table']['base'] = [
-    'field' => 'reference',
-    'title' => t('Webform Paystack Field'),
-    'help' => t('Webform Paystack Field Data contains data related to paystack transaction related to webforms.'),
-    'weight' => -10,
-  ];
-  $data['webform_paystack_data']['table']['join'] = [
-    'webform_submission' => [
-      'left_field' => 'sid',
-      'field' => 'webform_id',
-    ],
-    'node_field_data' => [
-      'left_field' => 'nid',
-      'field' => 'nid',
-    ],
-  ];
-  $data['webform_paystack_data']['reference'] = [
-    'title' => t('Paystack reference'),
-    'help' => t('Paystack reference'),
-    'field' => [
-      'id' => 'standard',
-    ],
-    'sort' => [
-      'id' => 'standard',
-    ],
-    'filter' => [
-      'id' => 'string',
-    ],
-    'argument' => [
-      'id' => 'string',
-    ],
-  ];
-  $data['webform_paystack_data']['trxref'] = [
-    'title' => t('Paystack transation reference'),
-    'help' => t('Paystack transation reference'),
-    'field' => [
-      'id' => 'standard',
-    ],
-    'sort' => [
-      'id' => 'standard',
-    ],
-    'filter' => [
-      'id' => 'string',
-    ],
-    'argument' => [
-      'id' => 'string',
-    ],
-  ];
-  $data['webform_paystack_data']['email'] = [
-    'title' => t('Email'),
-    'help' => t('Email'),
-    'field' => [
-      'id' => 'standard',
-    ],
-    'sort' => [
-      'id' => 'standard',
-    ],
-    'filter' => [
-      'id' => 'string',
-    ],
-    'argument' => [
-      'id' => 'string',
-    ],
-  ];
-  $data['webform_paystack_data']['first_name'] = [
-    'title' => t('First Name'),
-    'help' => t('First Name'),
-    'field' => [
-      'id' => 'standard',
-    ],
-    'sort' => [
-      'id' => 'standard',
-    ],
-    'filter' => [
-      'id' => 'string',
-    ],
-    'argument' => [
-      'id' => 'string',
-    ],
-  ];
-  $data['webform_paystack_data']['last_name'] = [
-    'title' => t('Last Name'),
-    'help' => t('Last Name'),
-    'field' => [
-      'id' => 'standard',
-    ],
-    'sort' => [
-      'id' => 'standard',
-    ],
-    'filter' => [
-      'id' => 'string',
-    ],
-    'argument' => [
-      'id' => 'string',
-    ],
-  ];
-  $data['webform_paystack_data']['amount'] = [
-    'title' => t('Amount'),
-    'help' => t('Amount'),
-    'field' => [
-      'id' => 'numeric',
-    ],
-    'sort' => [
-      'id' => 'standard',
-    ],
-    'filter' => [
-      'id' => 'numeric',
-    ],
-    'argument' => [
-      'id' => 'numeric',
-    ],
-  ];
-  $data['webform_paystack_data']['webform_id'] = [
-    'title' => t('Webform id'),
-    'help' => t('Webform Submission'),
-    'relationship' => [
-      'base' => 'webform_submission',
-      'base field' => 'sid',
-      'id' => 'standard',
-      'label' => t('Webform Submission'),
-    ],
-  ];
-  $data['webform_paystack_data']['status'] = [
-    'title' => t('Transaction status'),
-    'help' => t('Transaction status'),
-    'field' => [
-      'id' => 'numeric',
-    ],
-    'sort' => [
-      'id' => 'standard',
-    ],
-    'filter' => [
-      'id' => 'numeric',
-    ],
-    'argument' => [
-      'id' => 'numeric',
-    ],
-  ];
-  $data['webform_paystack_data']['private_key'] = [
-    'title' => t('Paystack Private key'),
-    'help' => t('Paystack Private key'),
-    'field' => [
-      'id' => 'standard',
-    ],
-    'sort' => [
-      'id' => 'standard',
-    ],
-    'filter' => [
-      'id' => 'string',
-    ],
-    'argument' => [
-      'id' => 'string',
-    ],
-  ];
-
-  return $data;
+#[LegacyHook]
+function webform_paystack_field_views_data()
+{
+    return \Drupal::service(WebformPaystackFieldViewsHooks::class)->viewsData();
 }
