Custom field interacts with JS

I want to add Braintree Payment field to my form.

var button = document.querySelector('#submit-button');

    braintree.dropin.create({
      authorization: 'CLIENT_AUTHORIZATION',
      container: '#dropin-container'
    }, function (createErr, instance) {
      button.addEventListener('click', function () {
        instance.requestPaymentMethod(function (requestPaymentMethodErr, payload) {
          // Submit payload.nonce to your server
        });
      });
    });


This is their simplest example.

What would be the "filament" way of adding payload.nonce to the form.
Was this page helpful?