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.
braintree.setup("<?=CLIENT_TOKEN_FROM_PHP?>",
"dropin",
{
container: "divBrainTreeContainer",
paymentMethodNonceReceived: function (event, nonce) {
console.log(nonce);
$('#formProfile').append('<input type="hidden" name="payment_method_nonce" value="'+nonce+'" />');
$('#formProfile').submit();
}
}
);
As per @kdetella's comment, there should be a submit
button inside the <form>
element to receive payment method nonce.