<script type="text/javascript">
  $(document).ready(function() {
    $provider_select = $("#gtwy-type");

    <% if Gem::Version.new(Spree.solidus_version) < Gem::Version.new('2.1.0') %>
      $display_on_select = $("#payment_method_display_on");

      $provider_select.on("change", function(e) {
        if (e.val == 'Spree::Gateway::KlarnaCredit') {
          $display_on_select.select2('val', 'front_end');
        } else {
          $display_on_select.select2('val', '');
        }
      })
    <% else %>
      $admin_checkbox = $("#payment_method_available_to_admin, #gateway_klarna_credit_available_to_admin");

      $provider_select.on("change", function(e) {
        console.log($provider_select);
        console.log($admin_checkbox.prop('checked'));
        if (e.val == 'Spree::Gateway::KlarnaCredit') {
          $admin_checkbox.prop('checked', false);
        } else {
          $admin_checkbox.prop('checked', true);
        }
      })
    <% end %>
  });
</script>

<script type="text/javascript">
  $(document).ready(function() {
    $provider_select = $("#gtwy-type");

    <% if (Spree.respond_to?(:solidus_version) && Gem::Version.new(Spree.solidus_version) < Gem::Version.new('2.1.0')) || !Spree.respond_to?(:solidus_version) %>
      $display_on_select = $("#payment_method_display_on");

      $provider_select.on("change", function(e) {
        if (e.val == 'Spree::Gateway::KlarnaCredit') {
          $display_on_select.select2('val', 'front_end');
        } else {
          $display_on_select.select2('val', '');
        }
      })
    <% else %>
      $admin_checkbox = $("#payment_method_available_to_admin, #gateway_klarna_credit_available_to_admin");

      $provider_select.on("change", function(e) {
        console.log($provider_select);
        console.log($admin_checkbox.prop('checked'));
        if (e.val == 'Spree::Gateway::KlarnaCredit') {
          $admin_checkbox.prop('checked', false);
        } else {
          $admin_checkbox.prop('checked', true);
        }
      })
    <% end %>
  });
</script>

Update for compatibility with Spree
Update for compatibility with Spree