wgltony / react-native-braintree-dropin-ui

React Native integration of Braintree Drop-in for IOS & ANDROID (Apple Pay, Google Pay, Paypal, Venmo, Credit Card)
MIT License
78 stars 105 forks source link

TypeError: null is not an object (evaluating '_reactNativeBraintreeDropinUi.default.show') #66

Open NabilaHashmi14 opened 3 years ago

NabilaHashmi14 commented 3 years ago

Hi I am implementing BraintreeDropIn package ("react-native-braintree-dropin-ui": "1.1.1") in my react native project and on testing I am getting this error every time I call .show() method of BraintreeDropIn

TypeError: null is not an object (evaluating '_reactNativeBraintreeDropinUi.default.show')

Here is my function:

BraintreeDropIn.show({
 clientToken: '123',
 merchantIdentifier: 'applePayMerchantIdentifier',
 countryCode: 'US',    //apple pay setting
 currencyCode: 'USD',   //apple pay setting
 merchantName: 'Your Merchant Name for Apple Pay',
 orderTotal:'Total Price',
 googlePay: true,
 applePay: true,
})
.then((result: any) => console.log(result))
.catch((error: any) => {
   if (error.code === 'USER_CANCELLATION') {
      // update your UI to handle cancellation
    } else {
      // update your UI to handle other errors
    }
});
Shahbazsultan5 commented 3 years ago

@NabilaHashmi14 Check the Client Token, it should be coming from your server. check this flow diagram to know how it works. https://developers.braintreepayments.com/start/overview#how-it-works

Seanmclem commented 3 years ago

I'm having this same error, after trying to setup 3D Secure. It was working fine before, and I have a valid clientToken already