diff --git a/js/commmerce_authnet.accept.form.js b/js/commmerce_authnet.accept.form.js
index 4f865e6..67c73e0 100644
--- a/js/commmerce_authnet.accept.form.js
+++ b/js/commmerce_authnet.accept.form.js
@@ -1,6 +1,6 @@
 /**
  * @file
- * Javascript to handle the authorize.net accept.js form.
+ * Javascript to generate Accept.js token in PCI-compliant way.
  */
 
 (function ($, Drupal, drupalSettings) {
@@ -18,7 +18,7 @@
     var $submit = $form.find('input.button--primary');
     $submit.prop('disabled', false);
 
-    // Sends the card data to Authorize.Net and receive the payment nonce in 
+    // Sends the card data to Authorize.Net and receive the payment nonce in
     // response.
     var sendPaymentDataToAnet = function (event) {
       var secureData = {};
@@ -52,13 +52,10 @@
       if (response.messages.resultCode === 'Error') {
         for (var i = 0; i < response.messages.message.length; i++) {
           console.log(response.messages.message[i].code + ': ' + response.messages.message[i].text);
+          Drupal.behaviors.commerceAuthorizeNetForm.errorDisplay(response.messages.message[i].text);
         }
-        alert('acceptJS library error!');
-        event.preventDefault();
       }
       else {
-        console.log(response);
-        console.log(response.opaqueData);
         processTransactionDataFromAnet(response.opaqueData);
       }
     };
@@ -72,8 +69,7 @@
       $('.accept-js-data-year', $form).val(expiration.year);
 
       // Clear out the values so they don't get posted to Drupal. They would
-      // never be used, but for PCI complaince we should never send them at 
-      // all.
+      // never be used, but for PCI compliance we should never send them at.
       $('#credit-card-number').val('');
       $('#expiration-month').val('');
       $('#expiration-year').val('');
diff --git a/js/commmerce_authnet.echeck.form.js b/js/commmerce_authnet.echeck.form.js
index abcb257..1fd0bd8 100644
--- a/js/commmerce_authnet.echeck.form.js
+++ b/js/commmerce_authnet.echeck.form.js
@@ -45,13 +45,10 @@
       if (response.messages.resultCode === 'Error') {
         for (var i = 0; i < response.messages.message.length; i++) {
           console.log(response.messages.message[i].code + ': ' + response.messages.message[i].text);
+          Drupal.behaviors.commerceAuthorizeNetForm.errorDisplay(response.messages.message[i].text);
         }
-        alert('acceptJS library error!');
-        event.preventDefault();
       }
       else {
-        console.log(response);
-        console.log(response.opaqueData);
 
         $('.accept-js-data-descriptor', $form).val(response.opaqueData.dataDescriptor);
         $('.accept-js-data-value', $form).val(response.opaqueData.dataValue);
diff --git a/js/commmerce_authnet.form.js b/js/commmerce_authnet.form.js
index 16e8534..cf61070 100644
--- a/js/commmerce_authnet.form.js
+++ b/js/commmerce_authnet.form.js
@@ -19,10 +19,10 @@
       var $submit = $form.find('input.button--primary');
       $submit.prop('disabled', false);
       var settings = drupalSettings.commerceAuthorizeNet;
-      if (settings.paymentMethodType == 'credit_card') {
+      if (settings.paymentMethodType === 'credit_card') {
         Drupal.commerceAuthorizeNetAcceptForm($form, settings);
       }
-      else if (settings.paymentMethodType == 'authnet_echeck') {
+      else if (settings.paymentMethodType === 'authnet_echeck') {
         Drupal.commerceAuthorizeNetEcheckForm($form, settings);
       }
     },
@@ -30,6 +30,16 @@
       var $form = $('.authorize-net-accept-js-form').closest('form');
       $form.removeOnce('authorize-net-accept-js-processed');
       $form.off('submit.authnet');
+    },
+    errorDisplay: function (code, error_message) {
+      var $form = $('.authorize-net-accept-js-form').closest('form');
+      // Display the message error in the payment form.
+      var errors = $form.find('#payment-errors');
+      errors.html(Drupal.theme('commerceAuthorizeNetError', error_message));
+      $('html, body').animate({ scrollTop: errors.offset().top });
+
+      // Allow the customer to re-submit the form.
+      $form.find('button').prop('disabled', false);
     }
   };
 
diff --git a/src/PluginForm/AuthorizeNet/PaymentMethodAddForm.php b/src/PluginForm/AuthorizeNet/PaymentMethodAddForm.php
index a4e0358..615400a 100644
--- a/src/PluginForm/AuthorizeNet/PaymentMethodAddForm.php
+++ b/src/PluginForm/AuthorizeNet/PaymentMethodAddForm.php
@@ -42,14 +42,14 @@ class PaymentMethodAddForm extends BasePaymentMethodAddForm {
       'paymentMethodType' => 'credit_card',
     ];
 
-    // Fields placeholder to be built by the JS
+    // Fields placeholder to be built by the JS.
     $element['credit_card_number'] = [
       '#type' => 'textfield',
       '#title' => t('Card number'),
       '#attributes' => [
         'placeholder' => '•••• •••• •••• ••••',
         'autocomplete' => 'off',
-        'autocorrect' =>  'off',
+        'autocorrect' => 'off',
         'autocapitalize' => 'none',
         'id' => 'credit-card-number',
         'required' => 'required',
@@ -76,16 +76,16 @@ class PaymentMethodAddForm extends BasePaymentMethodAddForm {
       '#attributes' => [
         'placeholder' => 'MM',
         'autocomplete' => 'off',
-        'autocorrect' =>  'off',
+        'autocorrect' => 'off',
         'autocapitalize' => 'none',
         'id' => 'expiration-month',
         'required' => 'required',
       ],
       '#label_attributes' => [
-         'class' => [
-           'js-form-required',
-           'form-required',
-         ],
+        'class' => [
+          'js-form-required',
+          'form-required',
+        ],
       ],
       '#maxlength' => 2,
       '#size' => 3,
@@ -102,7 +102,7 @@ class PaymentMethodAddForm extends BasePaymentMethodAddForm {
       '#attributes' => [
         'placeholder' => 'YY',
         'autocomplete' => 'off',
-        'autocorrect' =>  'off',
+        'autocorrect' => 'off',
         'autocapitalize' => 'none',
         'id' => 'expiration-year',
         'required' => 'required',
@@ -123,7 +123,7 @@ class PaymentMethodAddForm extends BasePaymentMethodAddForm {
       '#attributes' => [
         'placeholder' => '•••',
         'autocomplete' => 'off',
-        'autocorrect' =>  'off',
+        'autocorrect' => 'off',
         'autocapitalize' => 'none',
         'id' => 'cvv',
         'required' => 'required',
@@ -138,6 +138,13 @@ class PaymentMethodAddForm extends BasePaymentMethodAddForm {
       '#size' => 4,
     ];
 
+    // To display validation errors.
+    $element['payment_errors'] = [
+      '#type' => 'markup',
+      '#markup' => '<div id="payment-errors"></div>',
+      '#weight' => -200,
+    ];
+
     // Populated by the JS library after receiving a response from AuthorizeNet.
     $element['data_descriptor'] = [
       '#type' => 'hidden',
