mojtaba kavand mojtaba kavand - 1 month ago 20
C# Question

nonce value response delay cause send data without nonce value

In my checkout form I have to use some jQuery validation plugin to validate complex validation process, at the end of the track I send form data like this



$.validate({
modules: 'security , date',
onSuccess: function () {

// do Ajax call
return false;
},
});





but also I use Braintree setup like this



braintree.setup($("#btCilentToken").val(), 'dropin', {
container: 'dropin', paymentMethodNonceReceived: function (event, nonce) {

//get nonce save to javascript variable that be used in my final ajax call
}
});





now the problem is

sending form data-> tokenizing begins -> sending form data ends ->
(somewhere here the nonce value response back to server)
-> tokenizing ends

so I missed the nonce value because of delay

I tried differed object , timeout and some other approach but the problem is the function inside another object prevent me to sort them in proper order

every practice is much appreciated.

Answer

The new BT libs solve this problem.

Comments