Braintree - paymentMethodNonceReceived not being invoked

I have setup dropin UI for braintree. I can see the UI fine. Before that I created the customer and I can see the customer on braintree-sandbox. Now I want to add payment method to the customer. I am trying following code, but paymentMethodNonceReceived is not being invoked. Not sure why.

      container: "divBrainTreeContainer",
      paymentMethodNonceReceived: function (event, nonce) {
        $('#formProfile').append('<input type="hidden" name="payment_method_nonce" value="'+nonce+'" />');



I am using below JavaScript and its working fine:

  braintree.setup(clientToken, "custom", {
    id: "my-sample-form",
    hostedFields: {
      number: {
        selector: "#card-number"
      cvv: {
        selector: "#cvv"
      expirationMonth: {
        selector: "#expiration-month"
      expirationYear: {
        selector: "#expiration-year"
        return false;



Above gives below response and DOES NOT submit the form:


means use onPaymentMethodReceived instead of paymentMethodNonceReceived



As per @kdetella's comment, there should be a submit button inside the <form> element to receive payment method nonce.


For custom integration with multiple payment method, use onSuccess instead of onPaymentMethodReceived.

braintree.setup(TOKEN, 'custom', {
  id: 'checkout',
  paypal: {
    container: 'paypal-container',
    onSuccess: function (nonce, email) {
      // This will be called as soon as the user completes the PayPal flow
      // nonce:String
      // email: String
  onPaymentMethodReceived: function(obj) {
    // This will be called when the user submits the form


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.