diff --git a/payment/lib/Drupal/payment/Element/PaymentLineItem.php b/payment/lib/Drupal/payment/Element/PaymentLineItem.php
index b7560b0..49bd4ee 100644
--- a/payment/lib/Drupal/payment/Element/PaymentLineItem.php
+++ b/payment/lib/Drupal/payment/Element/PaymentLineItem.php
@@ -21,6 +21,8 @@ class PaymentLineItem {
    * Implements form #process callback.
    */
   public static function process(array $element, array &$form_state, array $form) {
+    debug($element['#parents']);
+    debug($form['instance']['#parents']);
     // Validate the element configuration.
     if (count($element['#default_value']) > $element['#cardinality']) {
       throw new \InvalidArgumentException('The number of default line items can not be higher than the cardinality.');
diff --git a/payment/lib/Drupal/payment/PaymentFormFieldWebTestBase.php b/payment/lib/Drupal/payment/PaymentFormFieldWebTestBase.php
new file mode 100644
index 0000000..a6209a6
--- /dev/null
+++ b/payment/lib/Drupal/payment/PaymentFormFieldWebTestBase.php
@@ -0,0 +1,80 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\payment\PaymentFormFieldWebTestbase..
+ */
+
+namespace Drupal\payment;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Contains functionality shared by payment_form field tests.
+ */
+class PaymentFormFieldWebTestbase extends WebTestBase {
+
+  /**
+   * The field.
+   *
+   * @var \Drupal\field\FieldInterface
+   */
+  protected $field;
+
+  /**
+   * The field instance.
+   *
+   * @var \Drupal\field\FieldInstanceInterface
+   */
+  protected $fieldInstance;
+
+  /**
+   * The content type the field is attached to.
+   *
+   * @var \Drupal\node\NodeInterface
+   */
+  protected $nodeType;
+
+  /**
+   * {@inheritdoc}
+   */
+  function setUp() {
+    parent::setUp();
+    $this->nodeType = $this->drupalCreateContentType();
+    $field_storage_controller = $this->container->get('plugin.manager.entity')->getStorageController('field_entity');
+    $this->field = $field_storage_controller->create(array(
+      'cardinality' => 2,
+      'id' => 'field_payment_form',
+      'type' => 'payment_form',
+    ));
+    $this->field->save();
+    $field_instance_storage_controller = $this->container->get('plugin.manager.entity')->getStorageController('field_instance');
+    $this->fieldInstance = $field_instance_storage_controller->create(array(
+      // @todo Configure the widget.
+      'bundle' => $this->nodeType->bundle(),
+      'entity_type' => 'node',
+      'field_uuid' => $this->field->uuid(),
+    ));
+    $this->fieldInstance->save();
+  }
+
+  /**
+   * Checks if a FieldValidationException contains a specified error code.
+   *
+   * @param FieldValidationException $e
+   * @param string $code
+   *
+   * @return boolean
+   *
+   * @todo Can we still use this?
+   */
+  function fieldValidationExceptionError(FieldValidationException $e, $code) {
+    $codes = array();
+    foreach ($e->errors['field_paymentform'][LANGUAGE_NONE][0] as $error) {
+      if ($error['error'] == $code) {
+        return TRUE;
+      }
+    }
+    return FALSE;
+  }
+}
diff --git a/payment/lib/Drupal/payment/Plugin/Core/Entity/Payment.php b/payment/lib/Drupal/payment/Plugin/Core/Entity/Payment.php
index 42daba4..0c6b47d 100644
--- a/payment/lib/Drupal/payment/Plugin/Core/Entity/Payment.php
+++ b/payment/lib/Drupal/payment/Plugin/Core/Entity/Payment.php
@@ -23,6 +23,9 @@ use Drupal\payment\Plugin\payment\status\PaymentStatusInterface;
  *   base_table = "payment",
  *   controllers = {
  *     "access" = "Drupal\payment\Plugin\Core\Entity\PaymentAccessController",
+ *     "form" = {
+ *       "payment_form_field" = "Drupal\payment\Plugin\Core\Entity\PaymentFormFieldFormController",
+ *     },
  *     "storage" = "Drupal\payment\Plugin\Core\Entity\PaymentStorageController",
  *   },
  *   entity_keys = {
diff --git a/payment/lib/Drupal/payment/Plugin/Core/Entity/PaymentFormFieldFormController.php b/payment/lib/Drupal/payment/Plugin/Core/Entity/PaymentFormFieldFormController.php
new file mode 100644
index 0000000..80dd9e8
--- /dev/null
+++ b/payment/lib/Drupal/payment/Plugin/Core/Entity/PaymentFormFieldFormController.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\payment\Plugin\Core\Entity\PaymentFormFieldFormController .
+ */
+
+namespace Drupal\payment\Plugin\Core\Entity;
+
+use Drupal\Core\Entity\EntityFormController;
+
+/**
+ * Provides the payment add form.
+ */
+class PaymentFormFieldFormController extends EntityFormController {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function form(array $form, array &$form_state) {
+    global $user;
+
+    $payment = $this->entity;
+
+    // @todo Show a payment_method form element. Show line items when we have a reusable element.
+
+    return parent::form($form, $form_state);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submit(array $form, array &$form_state) {
+    parent::submit($form, $form_state);
+    $values = $form_state['values'];
+    $this->entity->setId($values['id'])
+      ->setLabel($values['label'])
+      ->setStatus($values['status'])
+      ->setOwnerId(user_load_by_name($values['owner'])->id());
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function actions(array $form, array &$form_state) {
+    return array(
+      'pay' => array(
+        '#value' => t('Pay'),
+        '#submit' => array(
+          array($this, 'submit'),
+        ),
+      ),
+    );
+  }
+}
diff --git a/payment/lib/Drupal/payment/Plugin/field/field_type/FormField.php b/payment/lib/Drupal/payment/Plugin/field/field_type/FormField.php
new file mode 100644
index 0000000..ad37deb
--- /dev/null
+++ b/payment/lib/Drupal/payment/Plugin/field/field_type/FormField.php
@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * Contains Drupal\payment\Plugin\field\field_type\FormField.
+ */
+
+namespace Drupal\payment\Plugin\field\field_type;
+
+use Drupal\Core\Annotation\Translation;
+use Drupal\Core\Entity\Annotation\FieldType;
+use Drupal\field\FieldInterface;
+use Drupal\field\Plugin\Type\FieldType\ConfigFieldItemBase;
+
+/**
+ * Defines a payment form field.
+ *
+ * @FieldType(
+ *   default_widget = "payment_form",
+ *   default_formatter = "payment_form",
+ *   id = "payment_form",
+ *   instance_settings = {
+ *     "currency_code" = null
+ *   },
+ *   label = @Translation("Payment form")
+ * )
+ */
+class FormField extends ConfigFieldItemBase {
+
+  /**
+   * Definitions of the contained properties.
+   *
+   * @see static::getPropertyDefinitions()
+   *
+   * @var array
+   */
+  static $propertyDefinitions;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function schema(FieldInterface $field) {
+    $schema = array(
+      'columns' => array(
+        'amount' => array(
+          'type' => 'float',
+          'size' => 'big',
+          'not null' => TRUE,
+        ),
+        'currency_code' => array(
+          'type' => 'varchar',
+          'length' => 3,
+          'not null' => TRUE,
+        ),
+        'name' => array(
+          'type' => 'varchar',
+          'length' => '255',
+          'not null' => TRUE,
+        ),
+        'quantity' => array(
+          'type' => 'int',
+          'not null' => TRUE,
+        ),
+        // Line items are plugin instances, and there may be more data than the
+        // four required pieces that we know of and can store separately.
+        'line_item' => array(
+          'type' => 'blob',
+          'not null' => TRUE,
+          'serialize' => TRUE,
+        ),
+      ),
+    );
+
+    return $schema;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getPropertyDefinitions() {
+    if (!isset(static::$propertyDefinitions)) {
+      static::$propertyDefinitions = parent::getPropertyDefinitions();
+      // @todo Find a way to circumvent core's tedious "Let's force Symfony
+      //   constraints to be exposed to Drupal" limitation and set
+      //   Symfony\Component\Validator\Constraints\Type on the line item.
+      static::$propertyDefinitions['line_item'] = array(
+        'type' => 'any',
+        'label' => t('Line item'),
+        'required' => TRUE,
+      );
+    }
+
+    return static::$propertyDefinitions;
+  }
+}
diff --git a/payment/lib/Drupal/payment/Plugin/field/formatter/FormField.php b/payment/lib/Drupal/payment/Plugin/field/formatter/FormField.php
new file mode 100644
index 0000000..9c250b1
--- /dev/null
+++ b/payment/lib/Drupal/payment/Plugin/field/formatter/FormField.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\payment\Plugin\field\formatter\FormField.
+ */
+
+namespace Drupal\payment\Plugin\field\formatter;
+
+use Drupal\field\Annotation\FieldFormatter;
+use Drupal\Core\Annotation\Translation;
+use Drupal\field\Plugin\Type\Formatter\FormatterBase;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\Field\FieldInterface;
+
+/**
+ * Plugin implementation of the 'list_default' formatter.
+ *
+ * @FieldFormatter(
+ *   id = "payment_form",
+ *   label = @Translation("Payment form"),
+ *   field_types = {
+ *     "payment_form",
+ *   }
+ * )
+ */
+class FormField extends FormatterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function viewElements(EntityInterface $entity, $langcode, FieldInterface $items) {
+    $context_manager = \Drupal::service('plugin.manager.payment.context');
+    // @todo Set the entity reference.
+    $context = $context_manager->createInstance('payment_form');
+    $payment = entity_create('payment', array(
+      'context' => $context,
+    ))->setCurrencyCode($this->fieldDefinition->getFieldSetting('currency_code'))
+      ->setLineItems($this->fieldDefinition->getFieldSetting('line_items'));
+
+    return \Drupal::service('plugin.manager.entity')->getFormController('payment', 'payment_form_field')->setEntity($payment);
+  }
+
+}
diff --git a/payment/lib/Drupal/payment/Plugin/field/widget/FormField.php b/payment/lib/Drupal/payment/Plugin/field/widget/FormField.php
new file mode 100644
index 0000000..0a7f28f
--- /dev/null
+++ b/payment/lib/Drupal/payment/Plugin/field/widget/FormField.php
@@ -0,0 +1,67 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\payment\Plugin\field\widget\EmailDefaultWidget.
+ */
+
+namespace Drupal\payment\Plugin\field\widget;
+
+use Drupal\Core\Annotation\Translation;
+use Drupal\Core\Entity\Field\FieldInterface;
+use Drupal\currency\Plugin\Core\Entity\Currency;
+use Drupal\field\Annotation\FieldWidget;
+use Drupal\field\Plugin\Type\Widget\WidgetBase;
+
+/**
+ * A payment configuration widget.
+ *
+ * @FieldWidget(
+ *   field_types = {
+ *     "payment_form"
+ *   },
+ *   id = "payment_form",
+ *   label = @Translation("Payment configuration"),
+ *   multiple_values = "true"
+ * )
+ */
+class FormField extends WidgetBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $count = count($this->getSetting('line_items'));
+    $summary = array(format_plural($count, t('!count line item.'), t('!count line items'), array(
+      '!count' => $count,
+    )));
+
+    return $summary;
+  }
+
+  /**
+   * Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
+   */
+  public function formElement(FieldInterface $items, $delta, array $element, $langcode, array &$form, array &$form_state) {
+    $element['currency_code'] = array(
+      '#type' => 'select',
+      '#title' => t('Currency'),
+      '#options' => Currency::options(),
+      '#default_value' => $this->getSetting('currency_code'),
+      '#required' => TRUE,
+    );
+    $line_items = array();
+    foreach ($items as $item) {
+      $line_items[] = $item->line_item;
+    }
+    $line_items = array_filter($line_items);
+    $element['line_item'] = array(
+      '#cardinality' => $this->fieldDefinition->getFieldCardinality(),
+      '#default_value' => $line_items,
+      '#type' => 'payment_line_items',
+    );
+
+    return $element;
+  }
+
+}
diff --git a/payment/lib/Drupal/payment/Plugin/payment/context/FormField.php b/payment/lib/Drupal/payment/Plugin/payment/context/FormField.php
new file mode 100644
index 0000000..bffa46c
--- /dev/null
+++ b/payment/lib/Drupal/payment/Plugin/payment/context/FormField.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * Contains \Drupal\payment\Plugin\payment\context\FormField.
+ */
+
+namespace Drupal\payment\Plugin\payment\context;
+
+
+use Drupal\Core\Annotation\Translation;
+use Drupal\payment\Annotations\PaymentContext;
+use Symfony\Component\HttpFoundation\RedirectResponse;
+
+/**
+ * An unavailable context.
+ *
+ * @PaymentContext(
+ *   id = "payment_form",
+ *   label = @Translation("Payment form field")
+ * )
+ */
+class FormField extends Base {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function resume() {
+    parent::resume();
+    $payment = $this->getPayment();
+    if ($payment->access('view')) {
+      $uri = $payment->uri();
+      $view = ' ' . l(t('View payment'), $uri['path'], $uri['options']) . '.';
+    }
+    if ($payment->getStatus()->isOrHasAncestor('payment_pending')) {
+      drupal_set_message(t('Your payment is still being processed.') . $view);
+    }
+    elseif ($payment->getStatus()->isOrHasAncestor('payment_success')) {
+      drupal_set_message(t('Your payment was successfully completed.') . $view);
+    }
+    elseif ($payment->getStatus()->isOrHasAncestor('payment_failed')) {
+      drupal_set_message(t('Your payment failed.') . $view);
+    }
+
+    // @todo Add an entity reference field to the payment and use that.
+    $entity = entity_load($payment->context_data['entity_type'], $payment->context_data['entity_id']);
+    if ($uri = entity_uri($payment->context_data['entity_type'], $entity)) {
+      return new RedirectResponse(url($uri['path'], $uri['options']));
+    }
+    return new RedirectResponse(url('<front>'));
+
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function paymentDescription() {
+    // @todo Add an entity reference field to the payment and use that, or
+    //   perhaps add a configurable description to the entity, or use the entity
+    //   label, or–like 7.x-1.x–use the field instance label.
+    return t('Unavailable');
+  }
+}
diff --git a/payment/lib/Drupal/payment/Tests/Plugin/field/field_type/FormFieldWebTest.php b/payment/lib/Drupal/payment/Tests/Plugin/field/field_type/FormFieldWebTest.php
new file mode 100644
index 0000000..e1ceed2
--- /dev/null
+++ b/payment/lib/Drupal/payment/Tests/Plugin/field/field_type/FormFieldWebTest.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\payment\Tests\Plugin\field\field_type\FormFieldWebTest.
+ */
+
+namespace Drupal\payment\Tests\Plugin\field\field_type;
+
+use Drupal\payment\Generate;
+use Drupal\payment\PaymentFormFieldWebTestBase;
+
+/**
+ * Tests the payment_form field.
+ */
+class FormFieldWebTest extends PaymentFormFieldWebTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = array('payment_test');
+
+  /**
+   * {@inheritdoc}
+   */
+  static function getInfo() {
+    return array(
+      'description' => '',
+      'group' => 'Payment',
+      'name' => 'payment_form field',
+    );
+  }
+
+  /**
+   * Test the paymentform field validation.
+   */
+  function testPaymentformFieldValidation() {
+    $line_items = Generate::createPaymentLineItems();
+    $node = $this->drupalCreateNode(array(
+      'payment_form' => $line_items,
+      'type' => 'page',
+    ));
+    $node->save();
+    $node = entity_load_unchanged('node', $node->id());
+    $diff = array_diff_assoc($node->payment_form, $line_items);
+    $this->assertTrue(is_array($diff) && empty($diff), 'Payment line item data is saved and loaded correctly.');
+  }
+}
diff --git a/paymentform/tests/paymentform_test/tests/PaymentformTestFieldFormatterWebTestCase.php b/payment/lib/Drupal/payment/Tests/Plugin/field/formatter/FormFieldWebTest.php
similarity index 61%
rename from paymentform/tests/paymentform_test/tests/PaymentformTestFieldFormatterWebTestCase.php
rename to payment/lib/Drupal/payment/Tests/Plugin/field/formatter/FormFieldWebTest.php
index 9c9272d..966f40f 100644
--- a/paymentform/tests/paymentform_test/tests/PaymentformTestFieldFormatterWebTestCase.php
+++ b/payment/lib/Drupal/payment/Tests/Plugin/field/formatter/FormFieldWebTest.php
@@ -2,30 +2,30 @@
 
 /**
  * @file
- * Contains class PaymentformTestFieldFormatterWebTestCase.
+ * Contains Drupal\payment\Tests\Plugin\field\formatter\FormFieldWebTest.
  */
 
+namespace Drupal\payment\Tests\Plugin\field\formatter;
+
+use Drupal\payment\PaymentFormFieldWebTestBase ;
+
 /**
  * Tests the paymentform field formatter.
  */
-class PaymentformTestFieldFormatterWebTestCase extends PaymentformWebTestCase {
+class FormFieldWebTest extends PaymentFormFieldWebTestBase {
 
+  /**
+   * {@inheritdoc}
+   */
   static function getInfo() {
     return array(
-      'name' => 'Payment form field formatter',
-      'group' => 'Payment Form Field',
-      'dependencies' => array('paymentform_test'),
+      'description' => '',
+      'group' => 'Payment',
+      'name' => 'payment_form field formatter',
     );
   }
 
   /**
-   * Overrides parent::setUp().
-   */
-  function setUp(array $modules = array()) {
-    parent::setUp($modules + array('paymentform_test'));
-  }
-
-  /**
    * Test the paymentform field formatter.
    */
   function testPaymentformFieldFormatter() {
diff --git a/paymentform/tests/paymentform_test/tests/PaymentformTestLineItemFieldWidgetWebTestCase.php b/payment/lib/Drupal/payment/Tests/Plugin/field/widget/FormFieldWebTest.php
similarity index 65%
rename from paymentform/tests/paymentform_test/tests/PaymentformTestLineItemFieldWidgetWebTestCase.php
rename to payment/lib/Drupal/payment/Tests/Plugin/field/widget/FormFieldWebTest.php
index 23e7163..a9e8a9d 100644
--- a/paymentform/tests/paymentform_test/tests/PaymentformTestLineItemFieldWidgetWebTestCase.php
+++ b/payment/lib/Drupal/payment/Tests/Plugin/field/widget/FormFieldWebTest.php
@@ -1,30 +1,32 @@
 <?php
 
 /**
- * Contains class PaymentformTestLineItemFieldWidgetWebTestCase.
+ * Contains Drupal\payment\Tests\Plugin\field\widget\FormFieldWebTest.
  */
 
+namespace Drupal\payment\Tests\Plugin\field\widget;
+
+use Drupal\payment\PaymentFormFieldWebTestBase;
+
 /**
  * Tests the paymentform_line_item field widget.
  */
-class PaymentformTestLineItemFieldWidgetWebTestCase extends PaymentformWebTestCase {
+class FormFieldWebTest extends PaymentFormFieldWebTestBase{
 
-  static function getInfo() {
-    return array(
-      'name' => 'Payment line item field widget',
-      'group' => 'Payment Form Field',
-      'dependencies' => array('node'),
-    );
-  }
   /**
-   * Overrides parent::setUp().
+   * {@inheritdoc}
    */
+  public static $modules = array('node');
 
   /**
-   * Overrides parent::setUp().
+   * {@inheritdoc}
    */
-  function setUp(array $modules = array()) {
-    parent::setUp($modules + array('paymentform_test'));
+  static function getInfo() {
+    return array(
+      'description' => '',
+      'group' => 'Payment',
+      'name' => 'Payment line item field widget',
+    );
   }
 
   /**
diff --git a/payment_test/config/field.field.payment_form.yml b/payment_test/config/field.field.payment_form.yml
new file mode 100644
index 0000000..75124d4
--- /dev/null
+++ b/payment_test/config/field.field.payment_form.yml
@@ -0,0 +1,18 @@
+id: payment_form
+uuid: d70be755-8ce0-4379-891a-2615495c66b1
+status: '1'
+langcode: en
+type: payment_form
+settings: {  }
+module: payment
+active: '1'
+entity_types: {  }
+storage:
+  type: field_sql_storage
+  settings: {  }
+  module: field_sql_storage
+  active: '1'
+locked: '0'
+cardinality: '2'
+translatable: '0'
+indexes: {  }
diff --git a/payment_test/config/field.instance.payment_form.yml b/payment_test/config/field.instance.payment_form.yml
new file mode 100644
index 0000000..7e669ea
--- /dev/null
+++ b/payment_test/config/field.instance.payment_form.yml
@@ -0,0 +1,16 @@
+
+bundle: page
+default_value: {  }
+default_value_function: ''
+description: ''
+entity_type: node
+field_type: payment_form
+field_uuid: d70be755-8ce0-4379-891a-2615495c66b1
+id: node.page.payment_form
+label: 'Payment form'
+langcode: en
+required: '0'
+status: '1'
+settings:
+  handler: default
+  handler_settings: {  }
diff --git a/paymentform/paymentform.info.yml b/paymentform/paymentform.info.yml
deleted file mode 100644
index 083bcb3..0000000
--- a/paymentform/paymentform.info.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-name: Payment Form Field
-description: Provides a field to add payment forms to entities.
-core: 8.x
-type: module
-package: Payment
-dependencies:
-  - field
-  - payment
diff --git a/paymentform/paymentform.install b/paymentform/paymentform.install
deleted file mode 100644
index 00c0bf8..0000000
--- a/paymentform/paymentform.install
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * @file
- * Installation and uninstallation functions.
- */
-
-/**
- * Implements hook_field_schema().
- */
-function paymentform_field_schema($field) {
-  if ($field['type'] == 'paymentform') {
-    $schema = array(
-      'columns' => array(
-        'amount' => array(
-          'type' => 'float',
-          'size' => 'big',
-          'not null' => TRUE,
-        ),
-        'description' => array(
-          'type' => 'varchar',
-          'length' => 255,
-          'default' => '',
-        ),
-        'name' => array(
-          'type' => 'varchar',
-          'length' => '255',
-          'not null' => TRUE,
-        ),
-        'quantity' => array(
-          'type' => 'int',
-          'not null' => TRUE,
-        ),
-        'tax_rate' => array(
-          'type' => 'float',
-          'size' => 'big',
-          'not null' => TRUE,
-        ),
-      ),
-    );
-  }
-
-  return $schema;
-}
\ No newline at end of file
diff --git a/paymentform/paymentform.module b/paymentform/paymentform.module
deleted file mode 100644
index b62b22d..0000000
--- a/paymentform/paymentform.module
+++ /dev/null
@@ -1,244 +0,0 @@
-<?php
-
-/**
- * @file
- *   Hook implementations and general functions.
- */
-
-/**
- * Implements hook_field_info().
- */
-function paymentform_field_info() {
-  $field['paymentform'] = array(
-    'label' => t('Payment form'),
-    'description' => t('Adds a payment form to the <em>view</em> page.'),
-    'instance_settings' => array(
-      'currency_code' => 'XXX',
-    ),
-    'default_widget' => 'paymentform_line_item',
-    'default_formatter' => 'paymentform',
-  );
-
-  return $field;
-}
-
-/**
- * Implements hook_field_widget_info().
- */
-function paymentform_field_widget_info() {
-  $widget['paymentform_line_item'] = array(
-    'label' => t('Payment line item configuration'),
-    'description' => t("Allows users to configure line items for the form's payment."),
-    'field types' => array('paymentform'),
-    'behaviors' => array(
-      'multiple values' => FIELD_BEHAVIOR_CUSTOM,
-      'default value' => FIELD_BEHAVIOR_NONE,
-    ),
-  );
-
-  return $widget;
-}
-
-/**
- * Implements hook_field_formatter_info().
- */
-function paymentform_field_formatter_info() {
-  $formatters['paymentform'] = array(
-    'label' => t('Payment form'),
-    'field types' => array('paymentform'),
-  );
-
-  return $formatters;
-}
-
-/**
- * Implements hook_field_instance_settings_form().
- */
-function paymentform_field_instance_settings_form($field, $instance) {
-  $form = array();
-
-  if ($instance['widget']['type'] == 'paymentform_line_item') {
-    $form['currency_code'] = array(
-      '#type' => 'select',
-      '#title' => t('Currency'),
-      '#options' => payment_currency_options(),
-      '#default_value' => $instance['settings']['currency_code'],
-      '#required' => TRUE,
-    );
-  }
-
-  return $form;
-}
-
-/**
- * Implements hook_field_widget_form().
- */
-function paymentform_field_widget_form(array &$form, array &$form_state, array $field, array $instance, $langcode, array $items, $delta, array $element) {
-  global $user;
-
-  $default_value = array();
-  foreach ($items as $line_item_data) {
-    $default_value[] = new PaymentLineItem($line_item_data);
-  }
-  if ($instance['widget']['type'] == 'paymentform_line_item') {
-    $element = array(
-      '#type' => 'value',
-      // Use a validation callback to convert the PaymentLineItem objects from
-      // the payment_line_item element to arrays usable by Field API.
-      '#element_validate' => array('paymentform_field_widget_form_validate'),
-    ) + $element;
-    $element['line_item'] = array(
-      '#type' => 'payment_line_item',
-      '#currency_code' => $instance['settings']['currency_code'],
-      '#cardinality' => (int) $field['cardinality'],
-      '#default_value' => $default_value,
-      '#required' => $element['#required'],
-    );
-  }
-
-  return $element;
-}
-
-/**
- * Implements hook_field_validate().
- */
-function paymentform_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
-  if ($field['type'] == 'paymentform') {
-    foreach ($items as $delta => $line_item_data) {
-      $base = array(
-        'delta' => $delta,
-      );
-
-      // Amount.
-      $base['property'] = 'amount';
-      if (!is_float($line_item_data['amount'])) {
-        $errors[$field['field_name']][$langcode][$delta][] = array(
-          'error' => 'paymentform_line_item_amount_no_float',
-          'message' => t('The amount is no floating point.'),
-        ) + $base;
-      }
-
-      // Quantity.
-      $base['property'] = 'quantity';
-      if (!is_int($line_item_data['quantity'])) {
-        $errors[$field['field_name']][$langcode][$delta][] = array(
-          'error' => 'paymentform_line_item_quantity_no_integer',
-          'message' => t('The quantity is no integer.'),
-        ) + $base;
-      }
-      elseif ($line_item_data['quantity'] < 0) {
-        $errors[$field['field_name']][$langcode][$delta][] = array(
-          'error' => 'paymentform_line_item_quantity_negative',
-          'message' => t('The quantity cannot be negative.'),
-        ) + $base;
-      }
-
-      // Tax rate.
-      $base['property'] = 'tax_rate';
-      if (!is_float($line_item_data['tax_rate'])) {
-        $errors[$field['field_name']][$langcode][$delta][] = array(
-          'error' => 'paymentform_line_item_tax_rate_no_float',
-          'message' => t('The tax rate is no floating point.'),
-        ) + $base;
-      }
-      elseif ($line_item_data['tax_rate'] < 0) {
-        $errors[$field['field_name']][$langcode][$delta][] = array(
-          'error' => 'paymentform_line_item_tax_rate_negative',
-          'message' => t('The tax rate cannot be negative.'),
-        ) + $base;
-      }
-
-      // Machine name.
-      $base['property'] = 'name';
-      if (empty($line_item_data['name'])) {
-        $errors[$field['field_name']][$langcode][$delta][] = array(
-          'error' => 'paymentform_line_item_name_empty',
-          'message' => t('The machine-readable name is empty.'),
-        ) + $base;
-      }
-    }
-  }
-}
-
-/**
- * Implements hook_field_widget_error().
- */
-function paymentform_field_widget_error($element, $error, $form, &$form_state) {
-  // This is a form-element specific error.
-  if (isset($error['delta']) && isset($error['property'])) {
-    form_error($element['line_item']['container_' . $error['delta']][$error['property']], $error['message']);
-  }
-  // This is a field-wide error.
-  else {
-    form_error($element['line_item'], $error['message']);
-  }
-}
-
-/**
- * Implements hook_field_is_empty().
- */
-function paymentform_field_is_empty($item, array $field) {
-  if ($field['type'] == 'paymentform') {
-    return empty($item);
-  }
-}
-
-/**
- * Implements hook_field_formatter_view().
- */
-function paymentform_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
-  if ($display['type'] == 'paymentform') {
-    list($entity_id) = entity_extract_ids($entity_type, $entity);
-    $payment = new Payment(array(
-      'context_data' => array(
-        'entity_type' => $entity_type,
-        'entity_id' => $entity_id,
-      ),
-      'currency_code' => $instance['settings']['currency_code'],
-      'description' => $instance['label'],
-      'finish_callback' => 'paymentform_payment_finish',
-    ));
-    foreach ($items as $line_item_data) {
-      $payment->setLineItem(new PaymentLineItem($line_item_data));
-    }
-
-    return drupal_get_form('payment_form_standalone', $payment);
-  }
-}
-
-/**
- * Implements Payment::finish_callback.
- */
-function paymentform_payment_finish(Payment $payment) {
-  if (payment_access('view', $payment)) {
-    $view = ' ' . l(t('View payment'), 'payment/' . $payment->pid) . '.';
-  }
-  if (payment_status_is_or_has_ancestor($payment->getStatus()->status, PAYMENT_STATUS_PENDING)) {
-    drupal_set_message(t('Your payment is still being processed.') . $view);
-  }
-  elseif (payment_status_is_or_has_ancestor($payment->getStatus()->status, PAYMENT_STATUS_SUCCESS)) {
-    drupal_set_message(t('Your payment was successfully completed.') . $view);
-  }
-  elseif (payment_status_is_or_has_ancestor($payment->getStatus()->status, PAYMENT_STATUS_FAILED)) {
-    drupal_set_message(t('Your payment failed.') . $view);
-  }
-
-  $entity = entity_load_single($payment->context_data['entity_type'], $payment->context_data['entity_id']);
-  if ($uri = entity_uri($payment->context_data['entity_type'], $entity)) {
-    drupal_goto($uri['path'], $uri['options']);
-  }
-  drupal_goto('<front>');
-}
-
-
-
-/**
- * Implements form validate callback for a paymentform_line_item field widget.
- */
-function paymentform_field_widget_form_validate(array $element, array &$form_state) {
-  $line_items = array();
-  foreach ($form_state['values'][$element['#field_name']][$element['#language']]['line_item'] as $line_item) {
-    $line_items[] = (array) $line_item;
-  }
-  form_set_value($element, $line_items, $form_state);
-}
\ No newline at end of file
diff --git a/paymentform/tests/PaymentformWebTestCase.php b/paymentform/tests/PaymentformWebTestCase.php
deleted file mode 100644
index 6c6bb00..0000000
--- a/paymentform/tests/PaymentformWebTestCase.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains class PaymentformWebTestCase.
- */
-
-/**
- * Contains functionality shared by Paymentform test cases.
- */
-class PaymentformWebTestCase extends PaymentWebTestCase {
-  /**
-   * Overrides parent::setUp().
-   */
-
-  /**
-   * Overrides parent::setUp().
-   */
-  function setUp(array $modules = array()) {
-    parent::setUp($modules + array('field', 'node', 'paymentform'));
-
-    $this->content_type = $this->drupalCreateContentType();
-    // Field configuration.
-    $this->field_paymentform = field_create_field(array(
-      'field_name' => 'field_paymentform',
-      'type' => 'paymentform',
-      'cardinality' => 2,
-    ));
-    $this->field_paymentform_instance = field_create_instance(array(
-      'field_name' => 'field_paymentform',
-      'entity_type' => 'node',
-      'bundle' => $this->content_type->type,
-      'widget' => array(
-        'type' => 'paymentform_line_item',
-      ),
-    ));
-    $this->PaymentLineItemData = array(
-      'amount' => 1.0,
-      'description' => 'foo',
-      'name' => 'bar',
-      'quantity' => 1,
-      'tax_rate' => 0.0,
-    );
-  }
-
-  /**
-   * Checks if a FieldValidationException contains a specified error code.
-   *
-   * @param FieldValidationException $e
-   * @param string $code
-   *
-   * @return boolean
-   */
-  function fieldValidationExceptionError(FieldValidationException $e, $code) {
-    $codes = array();
-    foreach ($e->errors['field_paymentform'][LANGUAGE_NONE][0] as $error) {
-      if ($error['error'] == $code) {
-        return TRUE;
-      }
-    }
-    return FALSE;
-  }
-}
diff --git a/paymentform/tests/paymentform_test/paymentform_test.info b/paymentform/tests/paymentform_test/paymentform_test.info
deleted file mode 100644
index 63f2aa9..0000000
--- a/paymentform/tests/paymentform_test/paymentform_test.info
+++ /dev/null
@@ -1,10 +0,0 @@
-;name = Payment Form Field tests
-;description = "Supports Payment Form's automated tests."
-;core = 7.x
-;dependencies[] = paymentform
-;package = Payment
-;hidden = TRUE
-;files[] = tests/PaymentformTestCallablesWebTestCase.test
-;files[] = tests/PaymentformTestFieldWebTestCase.test
-;files[] = tests/PaymentformTestFieldFormatterWebTestCase.test
-;files[] = tests/PaymentformTestLineItemFieldWidgetWebTestCase.test
diff --git a/paymentform/tests/paymentform_test/paymentform_test.module b/paymentform/tests/paymentform_test/paymentform_test.module
deleted file mode 100644
index e69de29..0000000
diff --git a/paymentform/tests/paymentform_test/tests/PaymentformTestFieldWebTestCase.php b/paymentform/tests/paymentform_test/tests/PaymentformTestFieldWebTestCase.php
deleted file mode 100644
index 9f59dfd..0000000
--- a/paymentform/tests/paymentform_test/tests/PaymentformTestFieldWebTestCase.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains class PaymentformTestFieldWebTestCase.
- */
-
-/**
- * Tests the paymentform field.
- */
-class PaymentformTestFieldWebTestCase extends PaymentformWebTestCase {
-
-  static function getInfo() {
-    return array(
-      'name' => 'Payment form field',
-      'group' => 'Payment Form Field',
-    );
-  }
-
-  /**
-   * Test the paymentform field validation.
-   */
-  function testPaymentformFieldValidation() {
-    $node = $this->DrupalCreateNode(array(
-      'type' => $this->content_type->type,
-    ));
-    $line_item_data = array();
-    $node->field_paymentform[LANGUAGE_NONE][0] = &$line_item_data;
-
-    // Test that a non-float amount is invalid.
-    $line_item_data = array(
-      'amount' => 2,
-    ) + $this->PaymentLineItemData;
-    $message = "The <em>Payment form</em> field's validation throws an error if the amount is no float";
-    try {
-      field_attach_validate('node', $node);
-      $this->assertTrue(FALSE, $message);
-    }
-    catch (FieldValidationException $e) {
-      $this->assertTrue($this->fieldValidationExceptionError($e, 'paymentform_line_item_amount_no_float'), $message);
-    }
-
-    // Test the machine name, which cannot be empty.
-    $line_item_data = array(
-      'name' => '',
-    ) + $this->PaymentLineItemData;
-    $message = "The <em>Payment form</em> field's validation throws an error if the machine name is empty";
-    try {
-      field_attach_validate('node', $node);
-      $this->assertTrue(FALSE, $message);
-    }
-    catch (FieldValidationException $e) {
-      $this->assertTrue($this->fieldValidationExceptionError($e, 'paymentform_line_item_name_empty'), $message);
-    }
-
-    // Test that a non-integer quantity is invalid.
-    $line_item_data = array(
-      'quantity' => 1.0,
-    ) + $this->PaymentLineItemData;
-    $message = "The <em>Payment form</em> field's validation throws an error if the quantity amount is no integer";
-    try {
-      field_attach_validate('node', $node);
-      $this->assertTrue(FALSE, $message);
-    }
-    catch (FieldValidationException $e) {
-      $this->assertTrue($this->fieldValidationExceptionError($e, 'paymentform_line_item_quantity_no_integer'), $message);
-    }
-    // Test that a negative quantity is invalid.
-    $line_item_data = array(
-      'quantity' => -1,
-    ) + $this->PaymentLineItemData;
-    $message = "The <em>Payment form</em> field's validation throws an error if the quantity is negative";
-    try {
-      field_attach_validate('node', $node);
-      $this->assertTrue(FALSE, $message);
-    }
-    catch (FieldValidationException $e) {
-      $this->assertTrue($this->fieldValidationExceptionError($e, 'paymentform_line_item_quantity_negative'), $message);
-    }
-
-    // Test that a non-float tax rate is invalid.
-    $line_item_data = array(
-      'tax_rate' => 2,
-    ) + $this->PaymentLineItemData;
-    $message = "The <em>Payment form</em> field's validation throws an error if the tax rate is no float";
-    try {
-      field_attach_validate('node', $node);
-      $this->assertTrue(FALSE, $message);
-    }
-    catch (FieldValidationException $e) {
-      $this->assertTrue($this->fieldValidationExceptionError($e, 'paymentform_line_item_tax_rate_no_float'), $message);
-    }
-    // Test that a negative tax rate is invalid.
-    $line_item_data = array(
-      'tax_rate' => -1.0,
-    ) + $this->PaymentLineItemData;
-    $message = "The <em>Payment form</em> field's validation throws an error if the tax rate is negative";
-    try {
-      field_attach_validate('node', $node);
-      $this->assertTrue(FALSE, $message);
-    }
-    catch (FieldValidationException $e) {
-      $this->assertTrue($this->fieldValidationExceptionError($e, 'paymentform_line_item_tax_rate_negative'), $message);
-    }
-  }
-
-  /**
-   * Test the paymentform field storage.
-   */
-  function testPaymentformFieldStorage() {
-    $node = $this->drupalCreateNode(array(
-      'type' => $this->content_type->type,
-    ));
-    $node->field_paymentform[LANGUAGE_NONE][0] = $this->PaymentLineItemData;
-    node_save($node);
-    $node = node_load($node->nid, NULL, TRUE);
-    $diff = array_diff_assoc($node->field_paymentform[LANGUAGE_NONE][0], $this->PaymentLineItemData);
-    $this->assertTrue(is_array($diff) && empty($diff), 'Payment line item data is saved and loaded correctly.');
-  }
-}
