pikaju / flutter-braintree

Flutter plugin that wraps the native Braintree SDKs. Enables payments with credit cards, PayPal, Google Pay and more.
https://pub.dev/packages/flutter_braintree
MIT License
64 stars 119 forks source link

Error communicating with Paypal #34

Closed DriftingShadows closed 4 years ago

DriftingShadows commented 4 years ago

I'm getting this error "PlatformException (PlatformException(braintree_error, Error communicating with PayPal, null))" when trying to go through the native drop in flow with paypal. It happens after I press the button "Proceed with Sandbox Purchase".

image

I have verified the internet is working on the device. It would usually say something about unable to resolve hostname anyway if it were to do with the internet. I'm not too sure where the root of this issue is coming from (either something from my end or the package).

Also this whole paypal flow used to work where I would successfully get a nonce so not sure what happened since I havn't changed anything related to this.

pikaju commented 4 years ago

I haven't implemented this myself and I cannot test iOS builds at the moment. Could you check if version 1.0.1 of flutter_braintree fixes this issue?

DriftingShadows commented 4 years ago

I've tried it on both an iOS virtual device, android device through android studio and a pixel 2 xl phone connected to the computer. Is this problem replicable on your end?

I've updated the dependency to 1.0.2 but still get this error on Android. I get something else on iOS though. Apologies in advanced as I dont have much experience with iOS development/Xcode. I get this output in the debug console when trying to run on a simulated iOS device.

Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Running pod install...                                              1.3s
CocoaPods' output:
↳
      Preparing
    Analyzing dependencies
    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    Finding Podfile changes
      - Flutter
      - flutter_braintree
      - flutter_plugin_android_lifecycle
      - image_picker
      - url_launcher
      - url_launcher_macos
      - url_launcher_web
    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `flutter_braintree` from `.symlinks/plugins/flutter_braintree/ios`
    -> Fetching podspec for `flutter_plugin_android_lifecycle` from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`
    -> Fetching podspec for `image_picker` from `.symlinks/plugins/image_picker/ios`
    -> Fetching podspec for `url_launcher` from `.symlinks/plugins/url_launcher/ios`
    -> Fetching podspec for `url_launcher_macos` from `.symlinks/plugins/url_launcher_macos/ios`
    -> Fetching podspec for `url_launcher_web` from `.symlinks/plugins/url_launcher_web/ios`
    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_6_4_f.txt exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/6/4/f/BraintreeDropIn/8.1.0/BraintreeDropIn.podspec.json exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_d_a_5.txt exists! Returning local because checking is only perfomed in repo update
CDN: trunk Relative path: all_pods_versions_d_a_5.txt exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/d/a/5/Braintree/4.34.0/Braintree.podspec.json exists! Returning local because checking is only perfomed in repo update
    [!] CocoaPods could not find compatible versions for pod "BraintreeDropIn":
      In snapshot (Podfile.lock):
        BraintreeDropIn (= 8.1.0)
      In Podfile:
        flutter_braintree (from `.symlinks/plugins/flutter_braintree/ios`) was resolved to 0.2.0, which depends on
          BraintreeDropIn (= 7.3.0)
    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
     * changed the constraints of dependency `BraintreeDropIn` inside your development pod `flutter_braintree`.
       You should run `pod update BraintreeDropIn` to apply changes you've made.

I'm not too sure how to resolve this one.

pikaju commented 4 years ago

Okay this may have been my fault now. Probably not a great idea to publish versions without being able to test them, but here we are. I released a new version 1.0.2+1, could you check that one out? Although I must admit, if the error also occurs on Android this update probably won't fix your main issue. Did you follow correctly all the installation steps?

DriftingShadows commented 4 years ago

Okay this may have been my fault now. Probably not a great idea to publish versions without being able to test them, but here we are. I released a new version 1.0.2+1, could you check that one out? Although I must admit, if the error also occurs on Android this update probably won't fix your main issue. Did you follow correctly all the installation steps?

Yeah I'm doubtful it'll fix my android issues but should get iOS working as well. There is another error

Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Xcode build done.                                           11.6s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-1.0.2+1/ios/Classes/FlutterBraintreeDropInPlugin.swift:26:31: error: value of type 'BTDropInRequest' has no member 'amount'
                    dropInRequest.amount = amount
                    ~~~~~~~~~~~~~ ^~~~~~
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
    warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')

as I understand, if amount doesnt exist it goes through the vault flow? not sure if relevant.

Anyway in relation to the PlatformException error, its weird because it was working fine until one day, I launched it on my device and suddenly started giving that error. The error indicates as if there is some issue with Paypal but I doubt that (the credit card flow still works though).

enzobonggio commented 4 years ago

Okay this may have been my fault now. Probably not a great idea to publish versions without being able to test them, but here we are. I released a new version 1.0.2+1, could you check that one out? Although I must admit, if the error also occurs on Android this update probably won't fix your main issue. Did you follow correctly all the installation steps?

Yeah I'm doubtful it'll fix my android issues but should get iOS working as well. There is another error

Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Xcode build done.                                           11.6s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_braintree-1.0.2+1/ios/Classes/FlutterBraintreeDropInPlugin.swift:26:31: error: value of type 'BTDropInRequest' has no member 'amount'
                    dropInRequest.amount = amount
                    ~~~~~~~~~~~~~ ^~~~~~
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
    warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')

as I understand, if amount doesnt exist it goes through the vault flow? not sure if relevant.

Anyway in relation to the PlatformException error, its weird because it was working fine until one day, I launched it on my device and suddenly started giving that error. The error indicates as if there is some issue with Paypal but I doubt that (the credit card flow still works though).

are you using 3D Secure ? Maybe I can help to fix this as is a problem related to the version change. Since I don't understand how the flow should work, I don't know how to test it

pikaju commented 4 years ago

Aww man, this is yet another issue with the version change I did without being able to test it. That's really unfortunate.

DriftingShadows commented 4 years ago

Aww man, this is yet another issue with the version change I did without being able to test it. That's really unfortunate.

All good mate.

pikaju commented 4 years ago

I just published another update which should fix the compilation issues. Regarding PayPal, does the example app work for you?

DriftingShadows commented 4 years ago

I just published another update which should fix the compilation issues. Regarding PayPal, does the example app work for you?

all good now. iOS successfully compiles and paypal vault flow works fine. Android is working too now. Seems like braintree introduced a change that broke existing releases of FlutterBraintree ? What did they do?

pikaju commented 4 years ago

I have absolutely no clue :D maybe they changed their backend API? But that's great to hear, I'll close this then. Thank you for your patience.