diff --git a/payment/config/payment.schema.yml b/payment/config/payment.schema.yml
new file mode 100644
index 0000000..cccd47b
--- /dev/null
+++ b/payment/config/payment.schema.yml
@@ -0,0 +1,14 @@
+payment.payment_method.*:
+  type: mapping
+  label: 'Payment method'
+  mapping:
+    id:
+      type: string
+    label:
+      type: label
+    ownerId:
+      type: integer
+    pluginConfiguration:
+      type: mapping
+    pluginId:
+      type: string
diff --git a/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethod.php b/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethod.php
index a7c491a..eab9880 100644
--- a/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethod.php
+++ b/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethod.php
@@ -42,7 +42,7 @@ class PaymentMethod extends ConfigEntityBase implements PaymentMethodInterface {
    *
    * @var string
    */
-  protected $id;
+  public $id;
 
   /**
    * The human-readable label.
@@ -76,7 +76,7 @@ class PaymentMethod extends ConfigEntityBase implements PaymentMethodInterface {
     $properties['label'] = $this->label();
     $properties['ownerId'] = $this->getOwnerId();
     $properties['pluginConfiguration'] = $this->getPlugin()->getConfiguration();
-    $properties['pluginID'] = $this->getPlugin()->getPluginId();
+    $properties['pluginId'] = $this->getPlugin()->getPluginId();
 
     return $properties;
   }
diff --git a/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethodAccessController.php b/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethodAccessController.php
index b90d2f8..ac12e5b 100644
--- a/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethodAccessController.php
+++ b/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethodAccessController.php
@@ -34,7 +34,7 @@ class PaymentMethodAccessController extends EntityAccessController {
     }
     else {
       $permission = 'payment.payment_method.' . $operation;
-      return user_access($permission . '.any', $account) || user_access($permission . '.own', $account) && $entity->uid == $account->uid;
+      return user_access($permission . '.any', $account) || user_access($permission . '.own', $account) && $entity->getOwnerId() == $account->id();
     }
   }
 }
diff --git a/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethodStorageController.php b/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethodStorageController.php
index 87b187f..d1aa1cc 100644
--- a/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethodStorageController.php
+++ b/payment/lib/Drupal/payment/Plugin/Core/entity/PaymentMethodStorageController.php
@@ -22,10 +22,10 @@ class PaymentMethodStorageController extends ConfigStorageController {
     //has been fixed.
     global $user;
 
-    $payment = parent::create($values);
-    $payment->setOwnerId($user->id());
+    $payment_method = parent::create($values);
+    $payment_method->setOwnerId($user->id());
 
-    return $payment;
+    return $payment_method;
   }
 
   /**
@@ -35,10 +35,11 @@ class PaymentMethodStorageController extends ConfigStorageController {
    */
   protected function buildQuery($ids, $revision_id = FALSE) {
     $payment_methods = parent::buildQuery($ids, $revision_id);
-    $manager = $this->container->get('plugin.manager.payment.payment_method');
+    $manager = \Drupal::service('plugin.manager.payment.payment_method');
     foreach ($payment_methods as $payment_method) {
-      $payment_method->controller = $manager->createInstance($payment_method->controllerID, $payment_method->controllerConfiguration);
-      $payment_method->controllerID == $payment_method->controllerConfiguration = NULL;
+      $payment_method->setPlugin($manager->createInstance($payment_method->pluginId), $payment_method->pluginConfiguration);
+      unset($payment_method->pluginId);
+      unset($payment_method->pluginConfiguration);
     }
 
     return $payment_methods;
diff --git a/payment/lib/Drupal/payment/Tests/Plugin/Core/entity/PaymentMethodStorageControllerTest.php b/payment/lib/Drupal/payment/Tests/Plugin/Core/entity/PaymentMethodStorageControllerTest.php
new file mode 100644
index 0000000..bce919b
--- /dev/null
+++ b/payment/lib/Drupal/payment/Tests/Plugin/Core/entity/PaymentMethodStorageControllerTest.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * @file
+ * Contains class \Drupal\payment\Tests\Plugin\Core\entity\PaymentMethodStorageControllerTest.
+ */
+
+namespace Drupal\payment\Tests\Plugin\Core\entity;
+
+use Drupal\payment\Plugin\payment\method\PaymentMethodInterface as PluginPaymentMethodInterface;
+use Drupal\payment\Plugin\Core\entity\PaymentMethodInterface;
+use Drupal\payment\Tests\Utility;
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests \Drupal\payment\Plugin\Core\entity\PaymentMethodStorageController.
+ */
+class PaymentMethodStorageControllerTest extends WebTestBase {
+
+  public static $modules = array('payment');
+
+  /**
+   * {@inheritdoc}
+   */
+  static function getInfo() {
+    return array(
+      'name' => '\Drupal\payment\Plugin\Core\entity\PaymentMethodStorageController',
+      'group' => 'Payment',
+    );
+  }
+
+  /**
+   * Tests create();
+   */
+  function testCreate() {
+    $payment_method = entity_create('payment_method', array());
+    $this->assertTrue($payment_method instanceof PaymentMethodInterface);
+    $this->assertEqual(count($payment_method->validate()), 0);
+  }
+
+  /**
+   * Tests save();
+   */
+  function testSave() {
+    $payment_method = Utility::createPaymentmethod(1);
+    $payment_method->save();
+    $payment_method_loaded = entity_load_unchanged('payment_method', $payment_method->id());
+    $this->assertTrue($payment_method_loaded instanceof PaymentMethodInterface);
+    $this->assertTrue($payment_method_loaded->getPlugin() instanceof PluginPaymentMethodInterface);
+  }
+
+  /**
+   * Tests delete();
+   */
+  function testDelete() {
+    $payment_method = Utility::createPaymentMethod(1);
+    $payment_method->save();
+    $this->assertTrue($payment_method->id());
+    $payment_method->delete();
+    $this->assertFalse(entity_load('payment_method', $payment_method->id()));
+  }
+}
diff --git a/payment/lib/Drupal/payment/Tests/Utility.php b/payment/lib/Drupal/payment/Tests/Utility.php
index f285b22..5a77c81 100644
--- a/payment/lib/Drupal/payment/Tests/Utility.php
+++ b/payment/lib/Drupal/payment/Tests/Utility.php
@@ -53,12 +53,11 @@ class Utility {
   static function createPaymentMethod($uid, PaymentMethodInterface $plugin = NULL) {
     $name = Random::name();
     $plugin = $plugin ? $plugin : \Drupal::service('plugin.manager.payment.payment_method')->createInstance('payment_unavailable');
-    $payment_method = entity_create('payment_method', array(
-      'plugin' => $plugin,
-      'name' => $name,
-      'label' => $name,
-      'uid' => $uid,
-    ));
+    $payment_method = entity_create('payment_method', array())
+      ->setId($name)
+      ->setLabel($name)
+      ->setOwnerId($uid)
+      ->setPlugin($plugin);
 
     return $payment_method;
   }
