简体   繁体   中英

When does braintree drop in ui create payment method nonce?

I'm trying to integrate Braintree Drop In UI into a meteor app I'm working on. I've gotten the server to create a token for the client to create the drop in container. However I can't get it to create a payment method nonce. I'm using the callback for the nonce is created, but it isn't triggering when I submit.

This is the code for the container.

braintree.setup(response, 'dropin', {
  container: 'dropin-container',
  onPaymentMethodReceived: function(data) {
      Meteor.call('createCustomer', data.nonce);
  }
});

And this is the meteor event for submitting the form.

Template.reservePage.events({
    'submit #paymentForm': function(event) {
        event.preventDefault();
        FlowRouter.go('/dashboard');
        console.log("submitted");
    }
});

Is there supposed to be a method to call to trigger braintree to create a nonce?

(Posted on behalf of the OP) .

The issue was that the drop in was wrapped in another form inside the original form that was there. So when I submitted, it didn't register that the form it was in was submitted. Make sure it's only inside the one form!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM