GithubHelp home page GithubHelp logo

wgltony / react-native-braintree-dropin-ui Goto Github PK

View Code? Open in Web Editor NEW
76.0 6.0 100.0 3.11 MB

React Native integration of Braintree Drop-in for IOS & ANDROID (Apple Pay, Google Pay, Paypal, Venmo, Credit Card)

License: MIT License

Java 42.29% JavaScript 1.62% Objective-C 52.48% Ruby 3.61%

react-native-braintree-dropin-ui's Introduction

react-native-braintree-dropin-ui

React Native integration of Braintree Drop-in for IOS & ANDROID (Apple Pay, Google Pay, Paypal, Venmo, Credit Card)

Getting started

For React Native versions >= 0.60

IOS

npm install react-native-braintree-dropin-ui --save

OR

yarn add react-native-braintree-dropin-ui

cd ./ios
pod install

Android

npm install react-native-braintree-dropin-ui --save

OR

yarn add react-native-braintree-dropin-u

Configurate Payment Method(For ALL RN VERSIONS)

See Braintree's documentation, Apple Pay, Google Pay, Paypal, Venmo Once you have finished setting up all the configurations, it will show in the dropin UI.

For React Native versions < 0.60

Mostly automatic installation

react-native link react-native-braintree-dropin-ui

iOS specific

You must have a iOS deployment target >= 12.0.

If you don't have a Podfile or are unsure on how to proceed, see the CocoaPods usage guide.

In your Podfile, add:

# comment the next line to disable credit card scanning
pod 'CardIO'

When using React Native versions < 0.60, the following must also be added to your Podfile:

pod 'Braintree'

pod 'BraintreeDropIn'

 # comment the next line to disable Apple pay
pod 'Braintree/ApplePay'

 # comment the next line to disable PayPal
pod 'Braintree/PayPal'

 # comment the next line to disable Venmo
pod 'Braintree/Venmo'

 # Data collector for Braintree Advanced Fraud Tools
pod 'Braintree/DataCollector'

Then:

cd ios
pod repo update # optional and can be very long
pod install

Apple Pay

The Drop-in will show Apple Pay as a payment option as long as you've completed the Apple Pay integration and the customer's device and card type are supported.

PayPal

To enable paypal payments in iOS, you will need to add setReturnURLScheme to launchOptions of your AppDelegate.m / AppDelegate.mm

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [BTAppContextSwitcher setReturnURLScheme:@"com.your-company-name.your-app-name.payments"]; // ADD THIS LINE 
    return YES;
}

Android specific

Add in your MainActivity.java:

    import tech.power.RNBraintreeDropIn.RNBraintreeDropInModule;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // ...
        RNBraintreeDropInModule.initDropInClient(this);
    }

Note: Only complete the next steps if using React Native versions < 0.60, autolinking will do these steps automatically.

Add in your app/build.gradle:

dependencies {
...
    implementation project(':react-native-braintree-dropin-ui')
    implementation "io.card:android-sdk:5.+"
    implementation 'com.braintreepayments.api:data-collector:2.+'
    implementation 'com.google.android.gms:play-services-wallet:11.4.0'

Add in your MainApplication.java:

  import tech.power.RNBraintreeDropIn.RNBraintreeDropInPackage;


  return Arrays.<ReactPackage>asList(
             ... ...
             new RNBraintreeDropInPackage()  // <------ add here
         );

The below steps apply to all versions of React Native

If you wish to support Google Pay, add in your AndroidManifest.xml:

    <!-- Enables the Google Pay API -->
    <meta-data
        android:name="com.google.android.gms.wallet.api.enabled"
        android:value="true"/>

If you wish to support card swipe support, add in your 'app/build.gradle`:

dependencies {
...
    implementation "io.card:android-sdk:5.+"

Configuration

For more configuration options, see Braintree's documentation (iOS | Android).

3D Secure

If you plan on using 3D Secure, you have to do the following.

iOS
Configure a new URL scheme

Add a bundle url scheme {BUNDLE_IDENTIFIER}.payments in your app Info via XCode or manually in the Info.plist. In your Info.plist, you should have something like:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>com.myapp</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>com.myapp.payments</string>
        </array>
    </dict>
</array>
Update your code

In your AppDelegate.m:

#import "BraintreeCore.h"

...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    ...
    [BTAppContextSwitcher setReturnURLScheme:self.paymentsURLScheme];
    ...
}

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {

    if ([url.scheme localizedCaseInsensitiveCompare:self.paymentsURLScheme] == NSOrderedSame) {
        return [BTAppContextSwitcher handleOpenURL:url];
    }

    return [RCTLinkingManager application:application openURL:url options:options];
}

- (NSString *)paymentsURLScheme {
    NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
    return [NSString stringWithFormat:@"%@.%@", bundleIdentifier, @"payments"];
}

In your AppDelegate.swift:

import Braintree

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    ...
    BTAppContextSwitcher.setReturnURLScheme(self.paymentsURLScheme)
    ...
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    if let scheme = url.scheme, scheme.localizedCaseInsensitiveCompare(self.paymentsURLScheme) == .orderedSame {
        return BTAppContextSwitcher.handleOpen(url)
    }
    return RCTLinkingManager.application(app, open: url, options: options)
}

private var paymentsURLScheme: String {
    let bundleIdentifier = Bundle.main.bundleIdentifier ?? ""
    return bundleIdentifier + ".payments"
}

Usage

For the API, see the Flow typings.

Basic

import BraintreeDropIn from 'react-native-braintree-dropin-ui';

BraintreeDropIn.show({
  clientToken: 'token',
  merchantIdentifier: 'applePayMerchantIdentifier',
  googlePayMerchantId: 'googlePayMerchantId',
  countryCode: 'US',    //apple pay setting
  currencyCode: 'USD',   //apple pay setting
  merchantName: 'Your Merchant Name for Apple Pay',
  orderTotal:'Total Price',
  googlePay: true,
  applePay: true,
  vaultManager: true,
  payPal: true, 
  cardDisabled: false,
  darkTheme: true,
})
.then(result => console.log(result))
.catch((error) => {
  if (error.code === 'USER_CANCELLATION') {
    // update your UI to handle cancellation
  } else {
    // update your UI to handle other errors
  }
});

3D Secure

import BraintreeDropIn from 'react-native-braintree-dropin-ui';

BraintreeDropIn.show({
  clientToken: 'token',
  threeDSecure: {
    amount: 1.0,
  },
  merchantIdentifier: 'applePayMerchantIdentifier',
  googlePayMerchantId: 'googlePayMerchantId',
  countryCode: 'US',    //apple pay setting
  currencyCode: 'USD',   //apple pay setting
  merchantName: 'Your Merchant Name for Apple Pay',
  orderTotal:'Total Price',
  googlePay: true,
  applePay: true,
  vaultManager: true,
  payPal: true, 
  cardDisabled: false,
  darkTheme: true,
})
.then(result => console.log(result))
.catch((error) => {
  if (error.code === 'USER_CANCELLATION') {
    // update your UI to handle cancellation
  } else {
    // update your UI to handle other errors
    // for 3D secure, there are two other specific error codes: 3DSECURE_NOT_ABLE_TO_SHIFT_LIABILITY and 3DSECURE_LIABILITY_NOT_SHIFTED
  }
});

Fetch more recent payment method

import BraintreeDropIn from 'react-native-braintree-dropin-ui';

BraintreeDropIn.fetchMostRecentPaymentMethod(clientToken)
.then(result => console.log(result))
.catch((error) => {
  // Handle error
});

Tokenize card

import BraintreeDropIn from 'react-native-braintree-dropin-ui';

BraintreeDropIn.tokenizeCard(clientToken, {
  number: '4111111111111111',
  expirationMonth: '10',
  expirationYear: '23',
  cvv: '123',
  postalCode: '12345',
})
.then(cardNonce => console.log(cardNonce))
.catch((error) => {
  // Handle error
});

Custom Fonts

BraintreeDropIn.show({
  ...,
  fontFamily: 'Averta-Regular',
  boldFontFamily: 'Averta-Semibold',
})

react-native-braintree-dropin-ui's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-native-braintree-dropin-ui's Issues

Unrecognized selector sent to instance error.

When I try to implement ApplePay and set it to true to enable, we get this error in some simulators and projects. It's odd because one works...

Here is my code to enable the drop-in:

BraintreeDropIn.show({ clientToken: this.state.clientToken, merchantIdentifier: 'merchant.com.OURNAME.sandbox', countryCode: 'US', //apple pay setting currencyCode: 'USD', //apple pay setting merchantName: 'OUR NAME', orderTotal: amount + tip, googlePay: false, applePay: true, })
`

Is it something with how I have set this up? Here is more information on the error from the xcode logs when I run the simulator (iPhone8 though I'm not sure that matters).

2019-04-01 14:49:50.568483-0500 cc_mobile_v2[34969:59156397] -[__NSCFNumber length]: unrecognized selector sent to instance 0x855d871451cd895b
2019-04-01 14:49:50.586 [fatal][tid:main] Exception '-[__NSCFNumber length]: unrecognized selector sent to instance 0x855d871451cd895b' was thrown while invoking show on target RNBraintreeDropIn with params (
        {
        applePay = 1;
        clientToken = "sandbox_....";
        countryCode = US;
        currencyCode = USD;
        googlePay = 0;
        merchantIdentifier = "merchant.com.OURNAME.sandbox";
        merchantName = OURNAME;
        orderTotal = 25;
    },
    10262,
    10263
)
callstack: (
	0   CoreFoundation                      0x00000001133a91bb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x00000001121b5735 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001133c7f44 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x00000001133aded6 ___forwarding___ + 1446
	4   CoreFoundation                      0x00000001133afda8 _CF_forwarding_prep_0 + 120
	5   Foundation                          0x00000001113df5c9 -[NSScanner(NSDecimalNumberScanning) scanDecimal:] + 311
	6   Foundation                          0x00000001113dd499 -[NSDecimalNumberPlaceholder initWithString:locale:] + 127
	7   Foundation                          0x00000001113dda95 +[NSDecimalNumber decimalNumberWithString:] + 46
	8   cc_mobile_v2                        0x000000010f285eb0 -[RNBraintreeDropIn showWithOptions:resolver:rejecter:] + 1363
	9   CoreFoundation                      0x00000001133b003c __invoking___ + 140
	10  CoreFoundation                      0x00000001133ad4d5 -[NSInvocation invoke] + 325
	11  CoreFoundation                      0x00000001133ad926 -[NSInvocation invokeWithTarget:] + 54
	12  cc_mobile_v2                        0x000000010f1ad821 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 612
	13  cc_mobile_v2                        0x000000010f1f5f6b _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 255
	14  cc_mobile_v2                        0x000000010f1f5ce9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
	15  libdispatch.dylib                   0x0000000115eb8595 _dispatch_call_block_and_release + 12
	16  libdispatch.dylib                   0x0000000115eb9602 _dispatch_client_callout + 8
	17  libdispatch.dylib                   0x0000000115ec699a _dispatch_main_queue_callback_4CF + 1541
	18  CoreFoundation                      0x000000011330e3e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	19  CoreFoundation                      0x0000000113308a76 __CFRunLoopRun + 2342
	20  CoreFoundation                      0x0000000113307e11 CFRunLoopRunSpecific + 625
	21  GraphicsServices                    0x000000011973b1dd GSEventRunModal + 62
	22  UIKitCore                           0x00000001212fa81d UIApplicationMain + 140
	23  cc_mobile_v2                        0x000000010f08ecdf main + 80
	24  libdyld.dylib                       0x0000000115f2f575 start + 1
)
2019-04-01 14:49:50.586174-0500 cc_mobile_v2[34969:59156397] Exception '-[__NSCFNumber length]: unrecognized selector sent to instance 0x855d871451cd895b' was thrown while invoking show on target RNBraintreeDropIn with params (
        {
        applePay = 1;
        clientToken = "sandbox_...";
        countryCode = US;
        currencyCode = USD;
        googlePay = 0;
        merchantIdentifier = "merchant.com.OURNAME.sandbox";
        merchantName = OURNAME;
        orderTotal = 25;
    },
    10262,
    10263
)
callstack: (
	0   CoreFoundation                      0x00000001133a91bb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x00000001121b5735 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001133c7f44 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x00000001133aded6 ___forwarding___ + 1446
	4   CoreFoundation                      0x00000001133afda8 _CF_forwarding_prep_0 + 120
	5   Foundation                          0x00000001113df5c9 -[NSScanner(NSDecimalNumberScanning) scanDecimal:] + 311
	6   Foundation                          0x00000001113dd499 -[NSDecimalNumberPlaceholder initWithString:locale:] + 127
	7   Foundation                          0x00000001113dda95 +[NSDecimalNumber decimalNumberWithString:] + 46
	8   cc_mobile_v2                        0x000000010f285eb0 -[RNBraintreeDropIn showWithOptions:resolver:rejecter:] + 1363
	9   CoreFoundation                      0x00000001133b003c __invoking___ + 140
	10  CoreFoundation                      0x00000001133ad4d5 -[NSInvocation invoke] + 325
	11  CoreFoundation                      0x00000001133ad926 -[NSInvocation invokeWithTarget:] + 54
	12  cc_mobile_v2                        0x000000010f1ad821 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 612
	13  cc_mobile_v2                        0x000000010f1f5f6b _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 255
	14  cc_mobile_v2                        0x000000010f1f5ce9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
	15  libdispatch.dylib                   0x0000000115eb8595 _dispatch_call_block_and_release + 12
	16  libdispatch.dylib                   0x0000000115eb9602 _dispatch_client_callout + 8
	17  libdispatch.dylib                   0x0000000115ec699a _dispatch_main_queue_callback_4CF + 1541
	18  CoreFoundation                      0x000000011330e3e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	19  CoreFoundation                      0x0000000113308a76 __CFRunLoopRun + 2342
	20  CoreFoundation                      0x0000000113307e11 CFRunLoopRunSpecific + 625
	21  GraphicsServices                    0x000000011973b1dd GSEventRunModal + 62
	22  UIKitCore                           0x00000001212fa81d UIApplicationMain + 140
	23  cc_mobile_v2                        0x000000010f08ecdf main + 80
	24  libdyld.dylib                       0x0000000115f2f575 start + 1
)
2019-04-01 14:49:50.589808-0500 cc_mobile_v2[34969:59156397] *** Terminating app due to uncaught exception 'RCTFatalException: Exception '-[__NSCFNumber length]: unrecognized selector sent to instance 0x855d871451cd895b' was thrown while invoking show on target RNBraintreeDropIn with params (
        {
        applePay = 1;
        clientToken = "sandbox_...";
        countryCode = US;
        currencyCode = USD;
        googlePay = 0;
        merchantIdentifier = "merchant.com.OURNAME.sandbox";
        merchantName = OURNAME;
        orderTotal = 25;
    },
    10262,
    10263
)
callstack: (
	0   CoreFoundation                      0x00000001133a91bb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x00000001121b5735 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001133c7f44 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x00000001133aded6 ___forwarding___ + 1446
	4   CoreFoundation                      0x00000001133afda8 _CF_forwarding_prep_0 + 120
	5   Foundation                          0x00000001113df5c9 -[NSScanner(NSDecimalNumberScanning) scanDecimal:] + 311
	6   Foundation                          0x00000001113dd499 -[NSDecimalNumberPlaceholder initWithString:locale:] + 127
	7   Foundation                          0x00000001113dda95 +[NSDecimalNumber decimalNumberWithString:] + 46
	8   cc_mobile_v2                        0x000000010f285eb0 -[RNBraintreeDropIn showWithOptions:resolver:rejecter:] + 1363
	9   CoreFoundation                      0x00000001133b003c __invoking___ + 140
	10  CoreFoundation                      0x00000001133ad4d5 -[NSInvocation invoke] + 325
	11  CoreFoundation                      0x00000001133ad926 -[NSInvocation invokeWithTarget:] + 54
	12  cc_mobile_v2                        0x000000010f1ad821 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 612
	13  cc_mobile_v2                        0x000000010f1f5f6b _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 255
	14  cc_mobile_v2                        0x000000010f1f5ce9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
	15  libdispatch.dylib                   0x0000000115eb8595 _dispatch_call_block_and_release + 12
	16  libdispatch.dylib                   0x0000000115eb9602 _dispatch_client_callout + 8
	17  libdispatch.dylib                   0x0000000115ec699a _dispatch_main_queue_callback_4CF + 1541
	18  CoreFoundation                      0x000000011330e3e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	19  CoreFoundation                      0x0000000113308a76 __CFRunLoopRun + 2342
	20  CoreFoundation                      0x0000000113307e11 CFRunLoopRunSpecific + 625
	21  GraphicsServices                    0x000000011973b1dd GSEventRunModal + 62
	22  UIKitCore                           0x00000001212fa81d UIApplicationMain + 140
	23  cc_mobile_v2                        0x000000010f08ecdf main + 80
	24  libdyld.dylib                       0x0000000115f2f575 start + 1
)', reason: 'Exception '-[__NSCFNumber length]: unrecognized selector sent to instance 0x855d871451cd895b' was thrown while invoking show on target RNBraintreeDropIn with params (
        ...'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001133a91bb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x00000001121b5735 objc_exception_throw + 48
	2   cc_mobile_v2                        0x000000010f199d97 RCTFormatError + 0
	3   cc_mobile_v2                        0x000000010f1f6174 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 776
	4   cc_mobile_v2                        0x000000010f1f5ce9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
	5   libdispatch.dylib                   0x0000000115eb8595 _dispatch_call_block_and_release + 12
	6   libdispatch.dylib                   0x0000000115eb9602 _dispatch_client_callout + 8
	7   libdispatch.dylib                   0x0000000115ec699a _dispatch_main_queue_callback_4CF + 1541
	8   CoreFoundation                      0x000000011330e3e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	9   CoreFoundation                      0x0000000113308a76 __CFRunLoopRun + 2342
	10  CoreFoundation                      0x0000000113307e11 CFRunLoopRunSpecific + 625
	11  GraphicsServices                    0x000000011973b1dd GSEventRunModal + 62
	12  UIKitCore                           0x00000001212fa81d UIApplicationMain + 140
	13  cc_mobile_v2                        0x000000010f08ecdf main + 80
	14  libdyld.dylib                       0x0000000115f2f575 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) `

New release

Hey,

Are we going to release a new version to npm? Looks like there are some really good new changes, but last update is 1.0.9 😞

Proposal: Add the option to disable paypal payment method within the Drop-In

What problem are we trying to solve?

Upon integrating react-native-braintree-dropin-ui into an existing React Native project with a pre-existing module that handles Paypal payments, we needed a way to disable Paypal payment method via the Drop-in.

Why should we solve it?

While we appreciate that other apps might not need or even require this particular option, its addition would allow developers to have full control over the payment methods they want to use. Currently this module offers the options to disable googlePay,applePay and CreditCards but does not have the same option for disabling Paypal.

How do we propose to solve it?

We already have a patch file that adds this option to the react native layer and also adds supporting functionality to both native platforms.
A further change would be to update documentation to detail this change.

What could go wrong?

This option would be disabled by default which would match current expected behaviour.

Apple Pay

Having a hard time with Apple Pay. I got through the instructions and Apple Pay shows in the simulator, but not my device. When I click Apple Pay in the simulator it crashes with the following:

2019-06-11 09:40:15.191906-0500 KeyLink[31986:15434467] -canOpenURL: failed for URL: "com.venmo.touch.v2://x-callback-url/vzero/auth" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" 2019-06-11 09:40:15.786428-0500 KeyLink[31986:15434467] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: nonce)'

I figured it may only happen on the simulator, but I can't see Apply Pay there. Any ideas?

Task :react-native-braintree-dropin-ui:generateDebugBuildConfig FAILED

HI, I am getting below issue during creating android build in latest version of react-native.

"Execution failed for task ':react-native-braintree-dropin-ui:generateDebugBuildConfig'.

java.io.IOException: Unable to delete directory F:\react-native\baintree\ioscode\node_modules\react-native-braintree-dropin-ui\android\build\generated\source\buildConfig\debug\tech\bam."
Screenshot_1


Environment
"react": "16.8.6",
"react-native": "^0.60.5",
"react-native-braintree-dropin-ui": "^1.0.3",

Changing the language of the drop-in ui

Hi there!

Is there a way to change the language of the drop-in ui? I can't find anything about it in the Braintree-Doc either. For the JS-SDK it seems to be an attribute locale: 'de_DE' passed when creating the drop-in. Can you support this as well? Or do you already and I just can't figure out how to set this?

Thanks for your help!

how to get the nonce using braintree_tokenization_key?

Hi, I have implement this package for only get the nonce token base on card. How to implement this. Please tell me?

Requirement: User enter the card details and I have generate the nonce token. I have pass this nonce token to my custom Rest API.

Sample Code not working

Am I missing something? No errors or what so ever and followed the changes to build.gradle and androidmanifest.
I called the BraintreeDropIn.show but nothing happens. Am I missing an Initialization of some kind because it is not on the read me. Thank you!

React/RCTDefines.h file not found.

Hi there, I have a brand new react-native project configured and I followed all the steps to install this library. I'm getting the following build error with no luck on fixing it. Any ideas?
image

Dropin ui Issue

Drop in ui in not opening in TestFlight build can you help me

This is the code that i was using on click event
BraintreeDropIn.show({
clientToken: 'sandbox_rztvdzzh_gmnsckkypy3fvd6j',
countryCode: 'US', //apple pay setting
currencyCode: 'USD', //apple pay setting
merchantName: 'Moldtek',
orderTotal:'1.00',
googlePay: true,
applePay: true,
})
.then(result => {
Alert.alert('success', 'Braintree payment')

                Alert.alert('success', result.nonce)
                
                
            })
            .catch((error) => {
              if (error.code === 'USER_CANCELLATION') {
                // update your UI to handle cancellation
              } else {
                // update your UI to handle other errors
              }
            });

After ejecting project using expo
i am getting Drop in ui when i tested in device/simulator

Screenshot 2019-04-22 at 3 30 08 PM

but after testflight i am getting
Screenshot 2019-04-22 at 3 31 27 PM

Reopening - iOS - Paypal popup not showing

Hello,

Packages used
"react-native-braintree-dropin-ui": "^1.2.0",

  • Braintree/PayPal (~> 4.30)

Issue
When I'm opening the Braintree modal with "Credit Card" and "Paypal" options, when I'm clicking "Credit Card" everything is working. The paypal option is not working

Any idea to solve this issue ?

Android can't build

I can't build my Android app since I added the react-native-braintree-dropin-ui package. My Android app is not supporting AndroidX and I think this is the problem.

Packages:

"react": "16.8.3",
"react-native": "0.59.9",
"react-native-braintree-dropin-ui": "1.0.9"

The issue:

Program type already present: com.google.android.material.internal.package-info

> Task :app:transformDexArchiveWithDexMergerForDebug FAILED
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.google.android.material.internal.package-info

Tried solutions (but not working)

  • Change react-native-braintree-dropin-ui version
  • add multiEnabledDex true in my app/build.gradle
  • Migrate to AndroidX (but impossible to many packages to get up to date)
  • Use jetifier to convert/uncovert to AndroidX the node_modules packages.

Did someone face this compiling issue before ?

How do I enable Venmo Payments from the Drop In UI?

I was able to successfully setup this project but when I present the Drop In UI from the example I'm only show the option of PayPal or Credit Card. I'm on a simulator so I know Apple Pay wont show up, but I'm using the code from the example and expected Venmo to pup up as an option. Thanks for any help you can provide!

Could not invoke RNBraintreeDropIn.show null

Hi guys,
I just installed this lib and faced this an issue. Once I try to call
BraintreeDropIn.show({
clientToken: token.clientToken,
orderTotal: '20',
googlePay: true,
vaultManager: true,
})

I got this

Could not invoke RNBraintreeDropIn.show null Failed resolution of : Lcom/google/android/gms/internal/zzbck

image

"react-native": "0.59.9",

Added everything as described in README.md

Can someone suggest what is wrong with it?

Android app is crashing.

When I tried to test on Android it crashes

BraintreeDropIn.show({
     clientToken: token,
     googlePay: false
})

here is my build.gradle extensions:

        buildToolsVersion = "28.0.0"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28

iOS is working fine, tho.

An Internal error occurred.

After i enter all the card details and click on the Button, It is continuously giving me this error message.

versions:
react-native - 0.61.5
react - 16.9.0
react-native-braintree-dropin-ui - 1.0.9

1596618922428

BraintreeDropIn.show({ clientToken: clientToken, merchantIdentifier: '****************', googlePayMerchantId: 'googlePayMerchantId', countryCode: 'US', currencyCode: 'USD', merchantName: 'iTours', orderTotal:'${totalPrice}', googlePay: true, applePay: true, }) .then(result => { console.log('---result from BraintreeDropIn---', result); }) .catch(error => { console.log('Braintree error', error.message); alert(error.message); });

It is going in catch with the mentioned error every time i try to make payment.

App crashes

I did implemented same as guide, but app always crashes.
Is there any sample code that I can run so that I can confirm this module is really useful or not.

Please review your information and try again.

Hi
Everything is working fine with sandbox details but getting "Please review your information and try again" error popup in the live app. Please provide any solution for this issue. Here is the screenshot.
20200705_220713

Environment
"react": 16.9.0
"react-native": 0.61.5
"react-native-braintree-dropin-ui": 1.0.9

Android Dependency Collision (iOS works)

Getting this with react-native run-android:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:appcompat-v7' has different version for the compile (27.1.1) and runtime (28.0.0-rc02) classpath. You should manually set the same version via DependencyResolution

(iOS is working fine)

"Credit or Debit Cart" option is not showing in android.

I have used this library in my react-native app. Here is the code that I have used to call react-native-braintree-dropin-ui :

BraintreeDropIn.show({
  clientToken: brainTreeToken,
  countryCode: "US", //apple pay setting
  currencyCode: "USD", //apple pay setting
  orderTotal: cartAmount.toString(),
  googlePay: false,
  applePay: false,
  vaultManager: true,
  cardDisabled: false,
  darkTheme: true,
})
  .then((result) => {
    // here is an api to handle payment on server
  })
  .catch((error) => {
    if (error.code === "USER_CANCELLATION") {
      // code to handle user cancellation
    } else {
      // code to handle error
    }
  });

It successfully popup the braintree-dropin-ui. But the problem is that in android it only gives option to pay with paypal. It does not displaying "Credit or Debit Cart" option in pop up. However same code displaying both options, Paypal and Credit or Debit Cart in iOS.

Can anyone please help me what's the problem here ?

iOS - Paypal popup not showing

Hello,

Packages used

"react-native-braintree-dropin-ui": "^1.0.9",
  pod 'CardIO'
  pod 'Braintree', '~> 4.32'
  pod 'BraintreeDropIn', '~> 8.1.1'
  pod 'Braintree/Apple-Pay'
  pod 'Braintree/PayPal'
  # pod 'Braintree/Venmo'

   # Data collector for Braintree Advanced Fraud Tools
  pod 'Braintree/DataCollector'

Issue

When I'm opening the Braintree modal with "Credit Card" and "Paypal" options, when I'm clicking "Credit Card" everything is working. However, the paypal option is acting strangely: in dev mode ou release mode on simulator, the paypal popup appears and everything is OK, but when I'm trying on a real device, clicking on the "Paypal" option doesn't do anything and the bottomsheet closes.

The simulator and the real device both have iOS 13

Any idea to solve this issue ?

Error being thrown instead of a warning for bottomLayoutGuide being deprecated

I'm using Xcode 12.2 and when I build I'm getting an error that says 'bottomLayoutGuide' is deprecated: first deprecated in iOS 11.0 (similar message for 'topLayoutGuide')
There are three instances of this error that all happen in the BTDropInController.m file:

  • safeAreaHeight
  • topLayoutAnchor
  • bottomLayoutAnchor

Each of these instances all have a check for iOS 11 if (@available(iOS 11.0, *)) and my Deployment Target is set to iOS 11.0 so I can't figure out why I'm getting an error instead of just a warning since the code checks for iOS 11.0 or greater .
I've tried setting my Deployment Target to iOS 12.0 to see of that helps but there is no change.

the apple pay's code should be 18, no 16

https://github.com/braintree/braintree-ios-drop-in/blob/7.5.0/BraintreeUIKit/Public/BTUIKPaymentOptionType.h

please review this, the apple pay's code should be 18, no 16

cardDisabled not available in v1.1.1 because commented

Hi,

Why "cardDisabled" code is commented in version 1.1.1 ?
The only way to desable CardPayment is to modify RNBraintreeDropInModule.java and remove comment arround

if(options.hasKey("cardDisabled")) { dropInRequest.disableCard(); }

Android: Failed to link resources

When trying to build on android I get this message.

Android resource linking failed
node_modules/react-native-braintree-dropin-ui/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
node_modules/react-native-braintree-dropin-ui/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
node_modules/react-native-braintree-dropin-ui/android/build/intermediates/res/merged/release/values/values.xml:4320: error: resource android:attr/fontVariationSettings not found.
node_modules/react-native-braintree-dropin-ui/android/build/intermediates/res/merged/release/values/values.xml:4321: error: resource android:attr/ttcIndex not found.
error: failed linking references.

dependencies in build.gradle

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 26
        supportLibVersion = "28.0.0"
        // uncomment to get google to work
        googlePlayServicesAuthVersion = "15.0.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.0.1' // <--- use this version or newer

evaluating '_reactNativeBraintreeDropinUi.BraintreeDropIn.show

Hi, I was doing a first test to implement your drop-in for my react-native project and I get this issue everytime I try to open it

[Unhandled promise rejection: TypeError: undefined is not an object (evaluating '_reactNativeBraintreeDropinUi.BraintreeDropIn.show')]

My function:

const braintree_dropIn = async () => {
    let clientToken
    await getClientToken({
      variables: {
        customerId: userContext,
      },
    }).then((r) => {
      clientToken = r.data.getBraintreeToken
      console.log('response: ', r)
    })

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

Example App

Does anyone have an example app with all configurations ? Would be highly appreciated. Thanks in advance!

Disabling payment options?

Hi there, disabling payment options like - cardDisabled, paypal: false, googlePay: false, don't work in my case.. I think the package is just taking look at clientToken and showing whatever options u have activated in your braintree web platform, or am I doing something wrong ?

error: cannot find symbol RNBraintreeDropInPackage

Please provide any solution of this issue:-

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: F:\react-native\baintree\ioscode\node_modules\react-native-braintree-dropin-ui\android\src\main\java\tech\power\RNBraintreeDropIn\RNBraintreeDropInModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
F:\react-native\baintree\ioscode\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:19: error: cannot find symbol
import tech.bam.RNBraintreeDropIn.RNBraintreeDropInPackage;
^
symbol: class RNBraintreeDropInPackage
location: package tech.bam.RNBraintreeDropIn
F:\react-native\baintree\ioscode\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:58: error: cannot find symbol
new RNBraintreeDropInPackage(),
^
symbol: class RNBraintreeDropInPackage
location: class PackageList
2 errors
Screenshot_2

Environment:
"react": "16.8.6",
"react-native": "^0.60.5",
"react-native-braintree-dropin-ui": "^1.0.3",

3D secure question

Hi,

Can you please help me understand how should I treat 3DSECURE_NOT_ABLE_TO_SHIFT_LIABILITY and 3DSECURE_LIABILITY_NOT_SHIFTED errors?
From this and this code I understand that some payment requests may fail only because I provide threeDSecureOptions.

Does it mean I should NOT always ask for a payment to be 3DS in order to increase the successful payment rate?
If so how do I know for which payments I can ask for 3DS and for which I should NOT?
Thanks.

PS.
Are there any plans to make this repository to consume the newest Android v3 SDK from Braintree in order to support 3DS 2.0?

venmo not showing on ios

Hy! Venmo working fine on android but on ios, it's not showing in drop-in UI, any solution for that, thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.