Error during ionic cordova plugin add cordova-plugin-braintree

I’m adding the braintree plugin to my project (https://ionicframework.com/docs/native/braintree/) but when I launch ionic cordova plugin add https://github.com/taracque/cordova-plugin-braintree I have an error:

Error: Failed to fetch plugin https://github.com/taracque/cordova-plugin-braintree via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:275:12)
npm WARN addRemoteGit     at emitTwo (events.js:126:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:214:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:925:16)

npm WARN addRemoteGit     at Socket.stream.socket.on (internal/child_process.js:346:11)
npm WARN addRemoteGit     at emitOne (events.js:116:13)
npm WARN addRemoteGit     at Socket.emit (events.js:211:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:554:12)
npm WARN addRemoteGit  git+https://github.com/taracque/cordova-plugin-braintree.git resetting remote C:\Users\Nicco\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-taracque-cordova-plugin-braintree-git-9eccb564 beca
use of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:275:12)
npm WARN addRemoteGit     at emitTwo (events.js:126:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:214:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:925:16)
npm WARN addRemoteGit     at Socket.stream.socket.on (internal/child_process.js:346:11)
npm WARN addRemoteGit     at emitOne (events.js:116:13)
npm WARN addRemoteGit     at Socket.emit (events.js:211:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:554:12)
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm ERR! git clone --template=C:\Users\Nicco\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/taracque/cordova-plugin-braintree.git C:\Users\Nicco\AppData\Roaming\npm-cache\_git-remotes\git-https-gi
thub-com-taracque-cordova-plugin-braintree-git-9eccb564: Cloning into bare repository 'C:\Users\Nicco\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-taracque-cordova-plugin-braintree-git-9eccb564'...
npm ERR! git clone --template=C:\Users\Nicco\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/taracque/cordova-plugin-braintree.git C:\Users\Nicco\AppData\Roaming\npm-cache\_git-remotes\git-https-gi
thub-com-taracque-cordova-plugin-braintree-git-9eccb564: fatal: Unable to find remote helper for 'https'
npm ERR! Windows_NT 10.0.16299
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Nicco\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "https://github.com/taracque/cordova-plugin-braintree" "--production" "--save"
npm ERR! node v8.9.3
npm ERR! npm  v4.2.0
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Users\Nicco\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/taracque/cordova-plugin-braintree.git C:\Users\Nicco\AppData\Roam
ing\npm-cache\_git-remotes\git-https-github-com-taracque-cordova-plugin-braintree-git-9eccb564
npm ERR! Cloning into bare repository 'C:\Users\Nicco\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-taracque-cordova-plugin-braintree-git-9eccb564'...
npm ERR! fatal: Unable to find remote helper for 'https'
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Nicco\AppData\Roaming\npm-cache\_logs\2018-03-01T14_24_13_102Z-debug.log

[ERROR] An error occurred while running cordova plugin add https://github.com/taracque/cordova-plugin-braintree --save
        (exit code 1).

Download the repo in local and run ionic cordova plugin add 'C:\...\cordova-plugin-braintree-master'.
Problem solved :slight_smile: .

Hope it solved the issue. Also, after downloading, you might want to go to plugins/cordova-plugin-braintree/typings/cordova-plugin-braintree-tests.ts and look for where applePayOptions is defined (should be lines 17-21) and change ‘currency’ to ‘currencyCode’ (line 19), and ‘country’ to ‘countryCode’ (line 20). I had errors trying to build my app because of those, and fixed them by making those changes.
Hope this helps. Good luck.

Thanks, I solved. My problem was download the plugin from github, I don’t know why I was getting that error.

Hello, i use the same method like you to install braintree on ionic 4.
But when i test, with paypal i have this error Result was not RESULT_CANCELED, but no PaymentMethodNonce was returned from the Braintree SDK. , and with credit card my app is automatically closed.

I generate my clientToken with my spring server, i receive it correctly in ionic and follow the step provided in ionic native documentation from braintree.

All were good by your side?

Can you help me please?

have I forgotten something?
What configuration do I absolutely have to do on braintree platform?
What should I do ionic rating? What should I add? i am confuse.

Thanks for your help…

Hi, sorry but I didn’t use it on Ionic 4, but I’m still using it on Ionic 3 and it works. I think you have some errors in server side maybe in the token creation. I can’t help you with your spring server, but I followed all the step in the braintree docs for my server-side in php and it works. Try to open an issue in the github repo :slight_smile: