Using Braintree with js, But getting below error
Uncaught Error: Could not stringify event: JSON.stringify is not a function
I have added div in form(jsp page)
<div id="paypal-container"> <input type="submit" name="btnSub" value="Pay" id="btnSub"/> </div>
And in js Calling ajax to receive client token from api and the
braintree.setup(""+clientToken+"", "dropin", {
id: 'paypal-container',
paypal: {
container: "paypal-container",
onSuccess: function (nonce, email) {
console.log("email"+nonce+"\t "+email);
}
},
hostedFields: {
number: {
selector: "**** **** 1111 1111"
},
cvv: {
selector: "***"
},
expirationMonth: {
selector: "12"
},
expirationYear: {
selector: "2018"
}
},
onPaymentMethodReceived: function (obj) {
console.log(obj);
alert('onPaymentMethodReceived');
},
onError :function(obj){
alert('onError');
}
});
I run this on jquery load but getting above exception Please help.