kraffslol / react-native-braintree-xplat

Cross-platform Braintree module for React Native
MIT License
81 stars 121 forks source link

Having trouble making any function call to pass nonce to server after BTClient.getCardNonce() #41

Open raziboy939 opened 7 years ago

raziboy939 commented 7 years ago

I am unable to do anything within the BTClient.getCardNonce().then(function(nonce) { the only thing that seems to work is console.log. I have tried a fetch call to pass the nonce but that doesnt even happen. Neither do any calls to functions outside this scope. Am I missing something here? How am I supposed to pass the nonce to the server?

gitsebs commented 7 years ago

Hi @raziboy939

I was also facing this problem. I manage to get this working by using the following code

BTClient.showPaymentViewController({}).then((nonce) => {
          setTimeout(() => {
            alert(nonce, 'success')
          }, 1000)
        })

console.log also only worked for me. For any other code to run you have to delay it