jibon57 / nativescript-braintree Goto Github PK
View Code? Open in Web Editor NEWBraintree Payments (Drop-in) plugin for NativeScript
License: Apache License 2.0
Braintree Payments (Drop-in) plugin for NativeScript
License: Apache License 2.0
I get the following error if I set com.braintreepayments.api:braintree to >2.2.0 (tried 3.9.0) or com.braintreepayments.api:google-payment to > 2.0.1 (tried 3.3.1) in app.gradle:
System.err: java.lang.NoSuchMethodError: No static method newInstance(Landroid/app/Activity;Ljava/lang/String;)Lcom/braintreepayments/api/BraintreeFragment; in class Lcom/braintreepayments/api/BraintreeFragment; or its super classes (declaration of 'com.braintreepayments.api.BraintreeFragment' appears in /data/app/com.skywaylabs.WiSPLICE-YTPT-naKxfajuYllifOdJg==/base.apk)
System.err: at com.braintreepayments.api.dropin.BaseActivity.getBraintreeFragment(BaseActivity.java:62)
System.err: at com.braintreepayments.api.dropin.DropInActivity.onCreate(DropInActivity.java:109)
Can this support for let user to delete saved credit card by themselves?
/Users/saurabh.chauhan/Desktop/shyft/platforms/ios/Pods/Braintree/BraintreeCore/BTAPIClient.m:190:45: error: object of type 'NSNumber *' is not
compatible with dictionary value type 'NSString *' [-Werror,-Wobjc-literal-conversion]
parameters:@{@"default_first": @(defaultFirst),
^~~~~~~~~~~~~~~
I get this error when I try to build my app on Android:
A problem occurred configuring project ':app'. Could not GET 'https://cardinalcommerce.bintray.com/android/org/jfrog/cardinalcommerce/gradle/cardinalmobilesdk/2.2.4-1/cardinalmobilesdk-2.2.4-1.pom'. Received status code 403 from server: Forbidden
It seems linked to this issue on Android SDK:
braintree/braintree_android#293 (comment)
The solution is to update the Gradle file like said here:
braintree/braintree_android#293 (comment)
May i know why it doesn't prompt CVV input field when i select credit card payment type? It only request to enter for CC account and expiry date?
Has anyone encountered unknown error message when startPayment function is called?
After i tried to add credit card details, it prompt me fail result with unknown message as following:
{"_observers":{},"output":{"status":"fail","msg":"unknown","nonce":"","paymentMethodType":"","deviceInfo":""}}
I have submitted an app to the app store and been rejected due to a depreciated API 'UIWebView'. It looks like this is coming from this plugin and specifically the 3D-Secure Pod from Braintree.
Here's a link to an issue in the Braintree repository. It looks like there is a workaround and new Pod that replaces the 3D-Secure one. I'm not sure at this point if it's a straight up drop in replacement or if the new Pod will mean portions of this plugin will need adjusted to work with it. I'm not suing 3D-Secure at all, so I have no real way to test it's functionality for the replacement.
As a temporary work-around I've made adjustments to the Podfile in my local copy and the app store issue is resolved.
Here's my temporary Podfile:
pod 'BraintreeDropIn'
pod 'Braintree/Apple-Pay'
pod 'Braintree/PayPal'
pod 'Braintree/Venmo'
#pod 'Braintree/3D-Secure'
pod 'Braintree/PaymentFlow'
pod 'CardIO'
Hey guys, just tried to run the demo project.
After taping the button I get the above mentioned error from braintree.android.ts
, line 50.
It seems like com.braintreepayments.api.dropin.ThreeDSecureRequest
does not exist.
the content of com.braintreepayments.api.dropin
just seems to be { utils: {}, adapters: {}, interfaces: {}, view: {} }
Any idea?
Hi, I'm working on a Nativescript-Vue project, testing on iOS device, and getting the following error:
[BraintreeSDK] CRITICAL PayPal requires a return URL scheme to be configured via [BTAppSwitch setReturnURLScheme:]. This custom URL scheme must also be registered with your app.
I added the following code at the very top of my main.js file:
import { isAndroid, isIOS } from 'tns-core-modules/platform'
import { setupBraintreeAppDeligate } from "nativescript-braintree"
if (isIOS) {
setupBraintreeAppDeligate("com.mx.lasaves.vue.payments");
}
I have added the following to my Info.plist file as well:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.mx.lasaves.vue.payments</string>
</array>
</dict>
</array>
The auto-generated Info.plist in my platform folder result is like this:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.mx.lasaves.vue.payments</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>commxlasavesvue</string>
</array>
</dict>
</array>
<key>CFBundleIdentifier</key>
<string>com.mx.lasaves.vue</string>
Any ideas of why I'm still getting that error?
Thanks in advance!
On Android, everything in the drop-in ui is translated correctly (german in my case), but on iOS everything is shown in english only, even if the device has german language.
My config:
I tested the demo app of this repo. Is there any additional step to make the translations working on iOS?
I have a issue :
BraintreeBrowserSwitchActivity missing, incorrectly configured in AndroidManifest.xml or another app defines the same browser switch url as this app. See https://developers.braintreepayments.com/guides/client-sdk/android/v2#browser-switch for the correct configuration
It is possible to do this, to only activate the paypal payment method.
iOS Issue:
I have followed and review twice the instructions for setting up paypal... I see in the logs [BraintreeSDK] CRITICAL PayPal requires a return URL scheme to be configured via [BTAppSwitch setReturnURLScheme:]. This custom URL scheme must also be registered with your app.
My info.plist has:
fbXXXXXXXXXX (this is for FB login)
com.googleusercontent.apps.XXXXXXXXXX(this is for google login)
com.xxxxxx.myasanadiary
com.xxxxxx.myasanadiary.payments
myasanadiary
I have added the following to the main.ts:
setupBraintreeAppDeligate("com.xxxxxx.myasanadiary.payments");
Still getting the same.
Android Issue:
When checking out and selecting paypal... a forever spinner appears and I do not get any feedback on weather there is an issue of not. Any example of manifest.xml and app.gradle I could use.....
Any working example for nativescript angular I could take a look at. I am currently using nativescript 6.5 and angular 9. Please any help would be really appreciated.
Hello,
i want to ask, if i can set more options, like shipping address, or vault as payment method?
Thanks!
Best regards,
Stephan
Hello there, I did copy the code you had from your demo, the view-model.
I created a button that, when clicked, runs your function brainTreePayment
and when I click on it, this exception occurs:
System.err: com.tns.NativeScriptException:
System.err: Calling js method onClick failed
System.err:
System.err: TypeError: DropInRequest is not a constructor
System.err: File: "file:///data/data/org.nativescript.myappname/files/app/tns_modules/nativescript-braintree/braintree.js, line: 22, column: 28
System.err:
System.err: StackTrace:
System.err: Frame: function:'Braintree.startPayment', file:'file:///data/data/org.nativescript.myappname/files/app/tns_modules/nativescript-braintree/braintree.js', line: 22, column: 29
System.err: Frame: function:'HelloWorldModel.brainTreePayment', file:'file:///data/data/org.nativescript.myappname/files/app/main-view-model.js', line: 26, column: 19
System.err: Frame: function:'HelloWorldModel.onTapPayment', file:'file:///data/data/org.nativescript.myappname/files/app/main-view-model.js', line: 65, column: 14
System.err: Frame: function:'Observable.notify', file:'file:///data/data/org.nativescript.myappname/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 107, column: 32
System.err: Frame: function:'Observable._emit', file:'file:///data/data/org.nativescript.myappname/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 127, column: 18
System.err: Frame: function:'ClickListenerImpl.onClick', file:'file:///data/data/org.nativescript.myappname/files/app/tns_modules/tns-core-modules/ui/button/button.js', line: 26, column: 23
System.err:
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:996)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:983)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:967)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:959)
System.err: at com.tns.gen.java.lang.Object_button_19_32_ClickListenerImpl.onClick(Object_button_19_32_ClickListenerImpl.java:17)
System.err: at android.view.View.performClick(View.java:6294)
System.err: at android.view.View$PerformClick.run(View.java:24774)
System.err: at android.os.Handler.handleCallback(Handler.java:790)
System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
System.err: at android.os.Looper.loop(Looper.java:164)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6501)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
When running the demo app of this repo on my Android device (Google Pixel 3a Android 10), I do not see the Google Pay option, only PayPal and Credit card. I have configured Google Pay on my device correctly.
let opts: BrainTreeOptions = {
amount: "0.01",
collectDeviceData: false,
requestThreeDSecureVerification: true,
enableGooglePay: true,
// Apple Pay payment request
currencyCode: "EUR"
};
The meta-data tag is included in the AndroidManifest as described in the docs (it already exists within the demo app)
My config:
The Apple Pay Button is also missing on iOS, but that could be caused by the fact that I have not configured anything about Apple Pay on that device.
The plug in is very helpful, thanks very much! I got it work for credit card payment on android. But if I click on paypal option instead of credit card option, I see a busy cursor keep spinning, when I click on it, the process got cancelled and returned to my main screen, so I never get to paypal screen, I did set intent-filter in AndroidManifest.xml, what might be the solution for this? Thanks in advance!
Hi @jibon57, first cheers for the great work on this plugin! When using it without 3DSecure enabled everything works as expected. However, when setting requestThreeDSecureVerification: true
and thus requiring 3DS in order to meet PSD2 Strong Consumer Authentication problems start.
I've first noticed because I kept on getting errors when saving new cards on iOS (sandbox mode). These errors where not very helpful as they basically just said status: failed
. So I digged a bit deeper, compared the implementation with the Braintree docs and noticed that a required part was missing:
To use 3DS we will need to create a ThreeDSecureRequest
object for android (docs) and a BTThreeDSecureRequest
object for iOS (docs) both containing the amount and versionRequested which seems to be missing currently:
nativescript-braintree/src/braintree.android.ts
Lines 48 to 51 in c75061c
nativescript-braintree/src/braintree.ios.ts
Lines 35 to 37 in c75061c
I was able to resolve the issue with luke-hawk@9c76b18 for now. Let me know what you think or if I'm completely mistaken ;-)
Hello,
I've a small script to send a version to TestFlight, but I'm being blocked because an exception is being thrown. It seems to be caused by nativescript-braintree
plugin.
Just to clarify, I'm using NS 4.X, and the Braintree plugin version is 2.0.1.
rm -rf platforms
rm -rf node_nodules
tns prepare ios --bundle --provision "$PROVISION" --release --env.uglify
...
cd $PROJECT_DIR/platforms/ios
fastlane beta
This error occured:
The following build commands failed:
Ld /Users/<user_....>/Library/Developer/Xcode/DerivedData/TeleHealth-dvcmbqvqgydnpoemkxpoqhkoqall/Build/Intermediates.noindex/ArchiveIntermediates/TeleHealth/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/Braintree.build/Objects-normal/armv7/Braintree normal armv7
This log doesn't help, but I'm putting it here.
[18:50:56]:
[18:50:56]: โฌ๏ธ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[18:50:56]: ๐ For the complete and more detailed error log, check the full log at:
[18:50:56]: ๐ /Users/<user....>/Library/Logs/gym/TeleHealth-TeleHealth.log
[18:50:56]:
[18:50:56]: Looks like fastlane ran into a build/archive error with your project
[18:50:56]: It's hard to tell what's causing the error, so we wrote some guides on how
[18:50:56]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[18:50:56]: Before submitting an issue on GitHub, please follow the guide above and make
[18:50:56]: sure your project is set up correctly.
[18:50:56]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[18:50:56]: the full commands printed out in yellow in the above log.
[18:50:56]: Make sure to inspect the output above, as usually you'll find more error information there
(Everithing is working well when I do tns run ios
- it runs into the simulator).
Note: xcode version: 9.4.1
Hi. I updated my TNS to 4.2.4, Gradle to 4.10, and SDK to API 28.
Braintree is not building successfully, throwing error in the Gradle cache appcompat v7 28.0.0-rc02, complaining that AAPT fails, with attr dialogRadiusCorner not found, among other things.
Please help. It was working before, and some of my other plugins require compileSdk higher than 26.
Thank you so much. I would love to contribute to maintaining this but I am not good with Android development. Tried to read your code to find out how to modify for 3 days....
When startPayment function is called, with the respective token and options, selecting the Paypal option gives an fail status without showing any form for type the Paypal account. I have already configure the IOS project as in the documentation, also it fails in android.
Are there any solutions to this?
Hello, thank you for this plugin! It works perfectly even with Nativescript-vue.
But, something is wrong with languages in iOS, it show only English... I want it in French, no problem with the Android version.
I tried two things:
But nothing works, any idea about this? Thank you.
nativescript-braintree paypal not working in ios after a popup appear. it shows select "paypal"/"creditcard" , when i select credit card things works fine but if i select "paypal" no redirection work. My android works fine but when it comes to ios .paypal redirect to website not working. Kindly help .
Sorry - i can not
import { setupBraintreeAppDeligate } from "nativescript-braintree"
there is no export setupBraintreeAppDeligate
in the lib.
I have a fully functional integration where I can pay with Paypal / Credit Card. Based on docs, the Venmo support is just enabling Venmo in braintree gateway site, which I have done.
After enabling Venmo in braintree gateway, I can see Venmo enabled for one of my payment options. After selecting Venmo for payment, the client token is received as expected but the package does not execute the second call to payment processing endpoint. Is there any functional demo that could be referenced? Thank you for your support and this really nice package
Hi.
The instructions for PayPal Venmo implementation creates an issue with my app that is also doing Facebook login (Firebase).
If I include the suggested code for (app.ios), it will cause Facebook login to not redirect back to the app after logging in from Facebook. If I remove the code from my main.ts, the facebook login works fine and returns to my app, but Braintree will fail.
Can you suggest how to allow different URL schemes to be handled for UIResponder or custom app delegate?
Thanks.
I use device with iOS version 11.3. When choosing payment method Paypal, OS show a dialog for User to confirm allow use Paypal account. If user choose cancel, it will exception on initWithAuthorizationRequestHandler method.
let dropIn = BTDropInController.alloc().initWithAuthorizationRequestHandler(token, request, function(controller, result, error) {
if (error !== null) {
setTimeout(function() {
reject(t.output);
}, 500);
} else if (result.cancelled) {
t.output.status = 'cancelled';
t.output.msg = 'User has cancelled payment';
setTimeout(function() {
reject(t.output);
}, 500);
} else {
t.output.status = 'success';
t.output.msg = 'Got Payment Nonce Value';
t.output.nonce = result.paymentMethod.nonce; // result.paymentMethod = null
t.output.paymentMethodType = result.paymentMethod.type;
t.output.deviceInfo = PPDataCollector.collectPayPalDeviceData();
setTimeout(function() {
resolve(t.output);
}, 500);
}
controller.dismissViewControllerAnimatedCompletion(true, null);
});
We need to check this case when user choose cancel on confirm dialog.
Thanks
Hello !
Just for posterity, here are the steps I needed to follow to make it work with NativeScript-Vue (Android):
npm i --save nativescript-braintree
then
tns platform remove android
tns prepare android --bundle
then in my app.js
I put:
Vue.registerElement('Braintree', () => require('nativescript-braintree').Braintree)
Now in my code somewhere:
<template>
<Button @tap="processPayment" text="Pay"></Button>
</template>
<script>
import { Braintree, BrainTreeOptions } from 'nativescript-braintree';
export default {
methods:{
processPayment(){
let opt = {
amount: "1.0",
collectDeviceData: false,
requestThreeDSecureVerification: false,
};
let token = "TOKEN_HERE";
let braintree = new Braintree();
braintree.startPayment(token, opt);
braintree.on("success", function (res) {
let output = res.object.get("output");
console.dir(output);
});
braintree.on("cancel", function (res) {
let output = res.object.get("output");
console.dir(output);
});
braintree.on("error", function (res) {
let output = res.object.get("output");
console.dir(output);
});
}
}
}
</script>
finally
tns run android --bundle
while project is getting built, I get this message:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Skip com.braintreepayments.api.AndroidPayActivity
Error: java.lang.NullPointerException
But in the app it seems to work, I was successfully able to get tests from credit card payments.
Looks like BraintreeDropIn 7.5.0 will break the compile with Nativescript. Errors were related to certain colors not being found. My guess is this is because 7.5.0 introduced IOS Dark mode support.
Hard setting the Pod version to 7.4.0 inside this plugin' node_modules/nativescript-braintree/platforms/ios/Podfile
is a temporary workaround. pod 'BraintreeDropIn', '7.4.0'
I'm trying to do an Apple Pay transaction and when I tap on the Apple Pay option in the Drop-In UI the app crashes immediately.
This is part of the result
from initWithAuthorizationRequestHandler
inside of startPayment
in the plugin.
cancelled: false
paymentDescription: Apple Pay
paymentIcon: <BTUIKApplePayMarkVectorArtView: 0x11a919120; frame = (0 0; 0 0); opaque = NO; layer = <CALayer: 0x280ec2cc0>>
paymentMethod: null
paymentOptionType: 18
It throws the following error:
*** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: TypeError: null is not an object (evaluating 'result.paymentMethod.nonce')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.