Paypal Braintree integration error in Ionic Cordova: Untrusted SSL certificate chain

I am facing a problem on integrating Paypal payment through Braintree SDK(sandbox) in iOS using Ionic Cordova. I’m currently using the cordova-plugin-braintree": "^0.5.0" for the integration. There were no error upon building but I’m having an error returning on xcode simulator when I run the app.

Here’s the error it returned:

2020-08-06 11:13:43.519 TestApp[14370:510078] Untrusted SSL certificate chain. Refusing to communicate with PayPal servers.
2020-08-06 11:14:42.581040+0800 TestApp[14370:512020] Connection 9: received failure notification
2020-08-06 11:14:40.372864+0800 TestApp[14370:512187] Connection 2: strict TLS Trust evaluation failed(-9802)
2020-08-06 11:14:40.373839+0800 TestApp[14370:512187] Connection 2: TLS Trust encountered error 3:-9802
2020-08-06 11:14:42.582533+0800 TestApp[14370:512020] Connection 9: failed to connect 3:-9858, reason -1
2020-08-06 11:14:42.582903+0800 TestApp[14370:512020] Connection 9: encountered error(3:-9858)
2020-08-06 11:14:42.093680+0800 TestApp[14370:512020] [BoringSSL] boringssl_session_handshake_error_print(111) [C8.1:2][0x7fe27ff09ac0] 140610784112104:error:1000042e:SSL
2020-08-06 11:14:42.590881+0800 TestApp[14370:512020] Task <EB8A44D8-C0BA-4A3B-8C9B-7F524D38799A>.<3> HTTP load failed, 0/0 bytes (error code: -1200 [3:-9858])
2020-08-06 11:14:42.592 TestApp[14370:510078] [BraintreeSDK] WARNING Failed to send analytics event. Remote configuration fetch failed. An SSL error has occurred and a secure connection to the server cannot be made

While it returns this error on the app:

I already tried whitelisting domains and embedding the required frameworks in xcode.

I also already edited the info.plist in xcode like this one.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>CFBundleDevelopmentRegion</key>
     <string>en_US</string>
     <key>CFBundleDisplayName</key>
    <string>TestApp</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.2.3</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.2.3</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>NSCameraUsageDescription</key>
    <string>You can take photos</string>
        <key>NSMainNibFile</key>
    <string/>
        <key>NSMainNibFile~ipad</key>
    <string/>
    <key>UILaunchStoryboardName</key>
        <string>CDVLaunchScreen</string>
    <key>UIRequiresFullScreen</key>
    <true/>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
         <string>UIInterfaceOrientationPortrait</string>
         <string>UIInterfaceOrientationLandscapeLeft</string>
         <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</dict>
</plist>

Here’s my implementation using angular but I think the error is not coming from here:

import { Braintree, PaymentUIOptions, PaymentUIResult } from '@ionic-native/braintree/ngx';
...
paynow() {
    this.braintree.initialize(this.BRAINTREE_TOKEN)
        .then(() => this.braintree.presentDropInPaymentUI(this.paymentOptions))
        .then((result: PaymentUIResult) => {
            if (result.userCancelled) {
                console.log('User cancelled payment dialog.');
            } else {
                console.log('User successfully completed payment!');
                console.log('Payment Nonce: ' + result.nonce);
                console.log('Payment Result.', result);
            }
        })
        .catch((error: string) => console.error(error));
}

I’m testing this app on this environment:

  • Xcode v11
  • iPhone x (iOS 13)
  • Ionic v6.10.1
  • Cordova v9.0.0
  • Cordova-ios v5.1.1

Been stuck on this problem for a long time now. Hope you can help me on this one. Thanks in advance!

Hey there,
this old Braintree Plugin is maintained anymore and don’t uses the latest mobile SDK’s.
I created a new one, please read this to get known how to test it and support me in developing: