diff --git a/modules/payment/tests/src/Functional/PaymentMethodTest.php b/modules/payment/tests/src/Functional/PaymentMethodTest.php
new file mode 100644
index 0000000..16343fa
--- /dev/null
+++ b/modules/payment/tests/src/Functional/PaymentMethodTest.php
@@ -0,0 +1,130 @@
+<?php
+
+namespace Drupal\Tests\commerce_payment\Functional;
+
+use Drupal\commerce_payment\Entity\PaymentMethod;
+use Drupal\Tests\commerce\Functional\CommerceBrowserTestBase;
+
+/**
+ * Tests the payment method UI.
+ *
+ * @group commerce
+ */
+class PaymentMethodTest extends CommerceBrowserTestBase {
+
+  /**
+   * A normal user with minimum permissions.
+   *
+   * @var \Drupal\User\UserInterface
+   */
+  protected $user;
+
+  /**
+   * The uri for the payment method collection.
+   *
+   * @var string
+   */
+  protected $collectionUri;
+
+  /**
+   * An onsite payment gateway.
+   *
+   * @var \Drupal\commerce_payment\Entity\PaymentGatewayInterface
+   */
+  protected $paymentGateway;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = [
+    'commerce_payment',
+    'commerce_payment_example',
+  ];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    //TODO The permission setup is wrong as the user shouldn't need administration permission
+    $permissions = [
+      'administer commerce_payment',
+      'administer commerce_payment_gateway',
+    ];
+    $this->user = $this->drupalCreateUser($permissions);
+    $this->drupalLogin($this->user);
+
+    $this->collectionUri = 'user/' . $this->loggedInUser->id() . '/payment-methods';
+
+    /** @var \Drupal\commerce_payment\Entity\PaymentGateway $payment_gateway */
+    $payment_gateway = $this->createEntity('commerce_payment_gateway', [
+      'id' => 'example',
+      'label' => 'Example',
+      'plugin' => 'example_onsite',
+    ]);
+
+    $plugin = $payment_gateway->getPlugin();
+    $config = $plugin->getConfiguration();
+    $config['payment_method_types'] = ['credit_card'];
+    $plugin->setConfiguration($config);
+    $payment_gateway->save();
+    $this->paymentGateway = $payment_gateway;
+  }
+
+  /**
+   * Tests creating a payment method.
+   */
+  public function testPaymentMethodCreation() {
+    /** @var \Drupal\commerce_payment_example\Plugin\Commerce\PaymentGateway\OnsiteInterface $plugin */
+    $this->drupalGet($this->collectionUri);
+    $this->getSession()->getPage()->clickLink('Add payment method');
+    $this->assertSession()->addressEquals($this->collectionUri . '/add');
+
+    $form_values = [
+      'payment_method[payment_details][number]' => '4111111111111111',
+      'payment_method[payment_details][expiration][month]' => '01',
+      'payment_method[payment_details][expiration][year]' => date('Y') + 1,
+      'payment_method[payment_details][security_code]' => '111',
+      'payment_method[billing_information][address][0][country_code]' => 'AF',
+      'payment_method[billing_information][address][0][given_name]' => 'FirstName',
+      'payment_method[billing_information][address][0][family_name]' => 'LastName',
+      'payment_method[billing_information][address][0][address_line1]' => 'TestStreet',
+      'payment_method[billing_information][address][0][locality]' => 'TestTown',
+    ];
+    $this->submitForm($form_values, 'Save');
+    $this->assertSession()->addressEquals($this->collectionUri);
+    $this->assertSession()->pageTextContains('Visa ending in 1111 saved to your payment methods.');
+
+    $payment_method = PaymentMethod::load(1);
+    $this->assertEquals($this->user->id(), $payment_method->getOwnerId());
+  }
+
+  /**
+   * Tests deleting a payment method.
+   */
+  public function testPaymentMethodDeletion() {
+    $payment_method = $this->createEntity('commerce_payment_method', [
+      'uid' => $this->user->id(),
+      'type' => 'credit_card',
+      'payment_gateway' => 'example',
+    ]);
+
+    $details = [
+      'type' => 'visa',
+      'number' => '4111111111111111',
+      'expiration' => ['month' => '01', 'year' => date("Y") + 1],
+    ];
+    $this->paymentGateway->getPlugin()->createPaymentMethod($payment_method, $details);
+    $this->paymentGateway->save();
+
+    $this->drupalGet($this->collectionUri . '/' . $payment_method->id() . '/delete');
+
+    $this->getSession()->getPage()->pressButton('Delete');
+    $this->assertSession()->addressEquals($this->collectionUri);
+
+    $payment_gateway = PaymentMethod::load($payment_method->id());
+    $this->assertNull($payment_gateway);
+  }
+
+}
