Giter VIP home page Giter VIP logo

braintree-ios-drop-in's Introduction

Braintree iOS Drop-in SDK

Swift Package Manager compatible CocoaPods compatible

Release

Welcome to Braintree's Drop-in SDK for iOS!

Drop-in light theme

The Braintree iOS Drop-in SDK permits a deployment target of iOS 12.0 or higher. It requires Xcode 15.0+ and Swift 5.9+.

Table of Contents

  1. Getting Started
  2. Documentation
  3. Versions
  4. Demo App
  5. Help
  6. Feedback
  7. License

Getting Started

We recommend using Swift Package Manager or CocoaPods to integrate the Braintree Drop-in SDK with your project.

Swift Package Manager

This feature is only available in v9. v9.Y.0 requires Xcode 15.0+.

To add the BraintreeDropIn package to your Xcode project, select File > Swift Packages > Add Package Dependency and enter https://github.com/braintree/braintree-ios-drop-in as the repository URL. Tick the checkbox for BraintreeDropIn.

If you look at your app target, you will see that the BraintreeDropIn library is automatically linked as a framework to your app (see General > Frameworks, Libraries, and Embedded Content).

Note: There is a known SPM issue for apps with app extensions that use Swift Packages with binary dependencies. The issue occurs when uploading a build to App Store Connect. You can read the report on Swift Forums and follow this workaround.

CocoaPods

Add to your Podfile:

pod 'BraintreeDropIn'

Then run pod install.

See our Podspec for more information.

Note: If you are using version 8.x.x of the Braintree Drop-in iOS SDK in Xcode 12, you may see the warning The iOS Simulator deployment target is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. This will not prevent your app from compiling. This is a CocoaPods issue with a known workaround.

Documentation

Import BraintreeDropIn

Add the below import statement to any class where you are using BraintreeDropIn.

import BraintreeDropIn

Show Drop-in

Present BTDropInController to collect the customer's payment information and receive the nonce to send to your server. Saved payment methods will appear if you specified a customer_id when creating your client token.

func showDropIn(clientTokenOrTokenizationKey: String) {
    let request =  BTDropInRequest()
    let dropIn = BTDropInController(authorization: clientTokenOrTokenizationKey, request: request)
    { (controller, result, error) in
        if (error != nil) {
            print("ERROR")
        } else if (result?.isCanceled == true) {
            print("CANCELED")
        } else if let result = result {
            // Use the BTDropInResult properties to update your UI
            let selectedPaymentMethodType = result.paymentMethodType
            let selectedPaymentMethod = result.paymentMethod
            let selectedPaymentMethodIcon = result.paymentIcon
            let selectedPaymentMethodDescription = result.paymentDescription
        }
        controller.dismiss(animated: true, completion: nil)
    }
    self.present(dropIn!, animated: true, completion: nil)
}

Apple Pay + Drop-in

Apple Pay is enabled by default in Drop-in. Drop-in will show Apple Pay as a payment option as long as it is enabled in the control panel and the device supports it. To opt out, set applePayDisabled = true on your BTDropInRequest.

Important: If your customer selects Apple Pay as their preferred payment method then result.paymentMethodType == .applePay and the result.paymentMethod will be nil. Selecting Apple Pay does not display the Apple Pay sheet or create a nonce. After you receive the BTDropInResult, you will need to:

  1. Display a PKPaymentButton.
  2. Present a PKPaymentAuthorizationViewController when the customer taps the button.
  3. Tokenize the PKPayment and send the resulting nonce to your server to create a transaction.

Use BTApplePayClient to tokenize the customer's Apple Pay information - view our official docs for more information.

3D Secure + Drop-in

The Drop-in supports 3D Secure verification. You must have 3D Secure enabled in the Control Panel. Create a BTThreeDSecureRequest, setting as many fields on it as possible; the more fields that are set, the less likely it is that a user will be be presented with a challenge. Set the BTThreeDSecureRequest on BTDropInRequest.

let request = BTDropInRequest()

let threeDSecureRequest = BTThreeDSecureRequest()
threeDSecureRequest.threeDSecureRequestDelegate = self

threeDSecureRequest.amount = 1.00
threeDSecureRequest.email = "[email protected]"
threeDSecureRequest.requested = .version2

let address = BTThreeDSecurePostalAddress()
address.givenName = "Jill"
address.surname = "Doe"
address.phoneNumber = "5551234567"
address.streetAddress = "555 Smith St"
address.extendedAddress = "#2"
address.locality = "Chicago"
address.region = "IL"
address.postalCode = "12345"
address.countryCodeAlpha2 = "US"
threeDSecureRequest.billingAddress = address

// Optional additional information.
// For best results, provide as many of these elements as possible.
let additionalInformation = BTThreeDSecureAdditionalInformation()
additionalInformation.shippingAddress = address
threeDSecureRequest.additionalInformation = additionalInformation

request.threeDSecureRequest = threeDSecureRequest

Managing payment methods

By default, if you initialize the Drop-in with a client token generated with a customer ID, Drop-in will add payment methods to that customer within the Braintree Vault. You can optionally allow the deletion of payment methods for that customer by enabling vaultManager.

let request =  BTDropInRequest()
request.vaultManager = true

Fetch most recent payment method

If your user already has an existing payment method, you may not need to show the Drop-in UI. You can check if they have an existing payment method using BTDropInResult.mostRecentPaymentMethod. Note that you must use a client token that was created with a customer_id. BTDropInResult makes it easy to get a description and icon of the payment method.

Example payment method icon and description

BTDropInResult.mostRecentPaymentMethod(forClientToken: authorization) { result, error in
  guard let result = result, error == nil else {
    // either an error occurred or the customer doesn't have any vaulted payment methods
    return
  }

  if result.paymentOptionType == .applePay {
    // Apple Pay is the most recently selected option
    // Note that result.paymentMethod will be nil in this case; display Apple Pay button and tokenize using `BTApplePayClient`
  }

  // Update your UI
  let type = result.paymentMethodType
  let icon = result.paymentIcon
  let description = result.paymentDescription

  // Use the payment method to transact
  let paymentMethod = result.paymentMethod
}

Localization

Drop-in is currently localized for 22 languages.

Color Schemes

Drop-in is fully customizable, but we also provide Light, Dark and Dynamic color schemes. The dynamic color scheme will switch between light and dark based on whether the device is in light or dark mode. The Dynamic scheme is only available in iOS 13 or higher. Drop-in will use the Light color scheme by default.

let uiCustomization = BTDropInUICustomization(colorScheme: .dark)

let dropInRequest = BTDropInRequest()
dropInRequest.uiCustomization = uiCustomization

Drop-in dark theme

Customization

Use BTDropInUICustomization to customize the appearance of Drop-in.

let uiCustomization = BTDropInUICustomization(colorScheme: .dynamic)
uiCustomization.fontFamily = "Helvetica"
uiCustomization.boldFontFamily = "Helvetica Bold"

let dropInRequest = BTDropInRequest()
dropInRequest.uiCustomization = uiCustomization

Accessibility

Dynamic Type

Dynamic type is enabled by default for both system and custom fonts. We strongly encourage you to leave this feature on, but if you wish to disable it, you may do so by setting disableDynamicType to true on BTDropInUICustomization.

let uiCustomization = BTDropInUICustomization(colorScheme: .light)
uiCustomization.disableDynamicType = true

let dropInRequest = BTDropInRequest()
dropInRequest.uiCustomization = uiCustomization

VoiceOver

Drop-in UI elements support VoiceOver.

SwiftUI

Drop-in does not officially support SwiftUI at this time.

More Information

Start with 'Hello, Client!' for instructions on basic setup and usage.

Also see our reference documentation.

Versions

This SDK abides by our Client SDK Deprecation Policy. For more information on the potential statuses of an SDK check our developer docs.

Major version number Status Released Deprecated Unsupported
9.x.x Active April 2021 TBA TBA
8.x.x Deprecated Februrary 2020 April 2022 TBA
7.x.x Unsupported December 2018 April 2021 April 2022

Versions 6 and below are unsupported.

Demo

A demo app is included in this project. Running the demo app requires Xcode 15.0+. Open BraintreeDropIn.xcworkspace and run the Demo scheme to view it.

The demo app uses Swift Package Manager to fetch dependencies. Xcode will download dependencies automatically when you open the workspace. Deleting derived data will delete the dependencies. Go to File -> Swift Packages -> Resolve Package Versions to re-download them.

Help

Feedback

The Braintree iOS Drop-in SDK is in active development, we welcome your feedback!

Here are a few ways to get in touch:

License

The Braintree iOS Drop-in SDK is open source and available under the MIT license. See the LICENSE file for more info.

braintree-ios-drop-in's People

Contributors

agedd avatar billwerges avatar bluk avatar braebot avatar braintreeps avatar brandonjenniges avatar cooperbarth avatar demerino avatar dependabot[bot] avatar epreuve avatar gesa avatar hollabaq86 avatar intelliot avatar jackellenberger avatar jaxdesmarais avatar kaylagalway avatar kunjeongpark avatar lkorth avatar meismyles avatar nonepse avatar quinnjn avatar sarahkoop avatar scannillo avatar sestevens avatar shpuntov avatar sshropshire avatar stechiu avatar

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  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  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

braintree-ios-drop-in's Issues

Drop-In Static Library missing

Hello,
When adding the Braintree-Drop-In project following the Braintree Drop in Static Integration Guide, the library mentioned in step 5 (BraintreeDropIn-StaticLibrary) doesn't seem to exist in the downloaded files. The subproject does have a folder titled "BraintreeDropInStaticLibrary", but it appears to be empty.

Any ideas?

UnionPay beta build warning

General information

  • SDK/Library version: Braintree (4.7.4), BraintreeDropIn (5.1.0)
  • Integration type and version: CocoaPods 1.2.1

Issue description

Since this framework is dependant of UnionPay (although it is in beta), we are getting a warning in the pragma message in BTCardClient+UnionPay (line 1). How can we avoid this?

Thanks!

Localisation of existing payment description

General information

  • SDK/Library version: 5.2.3
  • Environment: Sandbox
  • iOS Version and Device: iOS 11.1 on an iPhone 7
  • Integration type and version: Custom

Issue description

We are getting the payment description string for existing payment in English and not localised to the device setting ([BTDropInResult paymentDescription]). So 'ending 1111' as opposed to 'ende 1111' when device set to German. Being seen in both iOS and Android use of the SDK. Is this due to still working against Sandbox or some other issue?

Thanks
Mark

Return to Merchant button shows after Paypal sandbox login

General information
SDK/Library version: iOS V4
Environment: Sandbox
iOS Version and Device: iOS 11.0 on iPad mini
Issue description
From Dropdown UI, when I tap on the Paypal it redirects to the paypal sanbox account page. And after successful login it just shows a "Return to merchant" button (the current url page where this button shows https://www.sandbox.paypal.com/checkoutnow?nolegacy=1&token=EC-7HE35921NK4087147&bt_int_type=2#/checkout/genericError?code=SU5WQUxJRF9SRVNPVVJDRV9JRA%3D%3D). When click on it, then it go back to the app dropdown UI page. And then this will check the if condition result.paymentOptionType and requestOneTimePayment:request method gets called. The variables tokenizedPayPalAccount and error are nil when checked.

      if(result.paymentOptionType == BTUIKPaymentOptionTypePayPal){

        self.braintreeClient = [[BTAPIClient alloc] initWithAuthorization:_tokenizationKey];
        BTPayPalDriver *payPalDriver = [[BTPayPalDriver alloc] initWithAPIClient:self.braintreeClient];
        payPalDriver.viewControllerPresentingDelegate = self;
        payPalDriver.appSwitchDelegate = self; // Optional
        // Specify the transaction amount here. "2.32" is used in this example.
        BTPayPalRequest *request= [[BTPayPalRequest alloc] initWithAmount:@"2.32"];
        request.currencyCode = @"USD"; // Optional; see BTPayPalRequest.h for other options
        
        [payPalDriver requestOneTimePayment:request completion:^(BTPayPalAccountNonce * _Nullable tokenizedPayPalAccount, NSError * _Nullable error) {
            if (tokenizedPayPalAccount) {
                NSLog(@"Got a nonce: %@", tokenizedPayPalAccount.nonce);

                // Access additional information
                NSString *email = tokenizedPayPalAccount.email;
                NSString *firstName = tokenizedPayPalAccount.firstName;
                NSString *lastName = tokenizedPayPalAccount.lastName;
                NSString *phone = tokenizedPayPalAccount.phone;

                // See BTPostalAddress.h for details
                BTPostalAddress *billingAddress = tokenizedPayPalAccount.billingAddress;
                BTPostalAddress *shippingAddress = tokenizedPayPalAccount.shippingAddress;
            } else if (error) {
                // Handle error here...
            } else {
                // Buyer canceled payment approval
            }
        }];

Payment page not showing after login. This is the issue

Thanks in advance

CVV error is not displayed

General information

  • SDK/Library version: 6.1.0
  • Environment: Sandbox
  • iOS Version and Device: iOS 10.3.1 on an iPhone 6
  • Integration type and version: CocoaPods 1.2.1

Issue description

Use the following card:

  • Number: 4000 0000 0000 0002
  • CVV: 200

This raises an error Record not found, and nothing is displayed on the Braintree UI.

Note that on Android, an error is successfully displayed in the drop-in UI.

Postcode only allows numeric input

General information

  • SDK/Library version: 4.14.0
  • Environment: Both
  • iOS Version and Device: iOS 11, iPhone 8
  • Integration type and version: Cocoapods 1.4.0

Issue description

When using the drop-in UI on a UK based environment the Post code field displays, but it provides an example that looks rather like a zip code, it also provides only a numeric input keypad and doesn't allow me to enter a valid postcode, therefore I cannot process payments.

screen shot 2018-04-23 at 15 26 48

Black square flickering over payment method selection popup

Issue when presenting the Drop-in controller - the payment selection view slides up and then has a black square that flickers over the payment options. This then seems to fade away behind the payment options, but is still visible behind them (its colour swapping between black and grey).

Seems to just randomly start appearing on devices at random times (happened on 2 different devices so far), at which point the only way to get rid of it is to restart the device. Force killing the app, or even deleting the app and reinstalling it does not solve it. Only restarting the device. This issue doesn't seem to occur when the app is first installed, but seems to just 'appear' randomly after a period of time.

Not sure if it could be something to do with memory? When presenting the Drop-in and then hitting cancel once it has loaded, the memory usage seems to increase by around 0.2/0.3 MB each time so not sure if there is a leak here somewhere?

The issue was occurring both plugged into the computer and not.

Screenshots attached for reference:

1
2
3
4

NSURL -999 Error when 3d secure is enabled for a certain card

General information

Using Braintree (4.9.6)
Using BraintreeDropIn (5.2.3)

Environment: Sandbox & Production
iOS Version and Device: iOS 11 on an iPhone 7, iPhone X, Simulator
Integration type and version: LATEST

Issue description

Hello, after working with the SDK, we have an issue when we try to 3d-secure a certain card. With other cards is DropIn and 3d-secure works as expected.

The problem seems to be with this type of card (Sweden):

MasterCard Debit
Bank: SEB

The SDK tries for 3d-secure but returns the NSURL -999 error, then closes the modal.

apple pay

Is apple pay integration working as intended? Why request.paymentMethod should be always nil?
I wonder if there are plans to implement full apple pay flow in drop in and return payment nonce like with other methods or that is impossible for some reasons?

As I understand right now all apply pay integration does it returns you "Customer wants to pay with Apple Pay" and nothing else, so we have to initiate flow manually?

When 3D Secure fails, the card is registered in Braintree and when the user chooses it from the UI, 3D secure is not verified again

General information

  • SDK/Library version: 6.1.0
  • Environment: Sandbox
  • iOS Version and Device: iOS 10.3.1 on an iPhone 6
  • Integration type and version: CocoaPods 1.2.1

Issue description

  1. Show the drop-in UI
  2. Add the card 4000 0000 0000 0028
  3. Drop-in correctly returns an error
  4. Show the drop-in UI
  5. The card 4000 0000 0000 0028 is shown is the list (seems weird, but that's what also happens on Android)
  6. Click on the card
  7. Drop-in returns a nonce without any error (it should at least return an error or verify 3D Secure again like on Android)

On Android, 3D Secure is verified every time when choosing a card from the drop-in ui.

iOS 8+ cannot use braintree-ios-drop-in?

My project base on iOS 8.0 , Can I use braintree-ios-drop-in? Or I need to use braintree_ios.
There is another question, My App cannot jump to PayPal App when I install PayPal App.

Can you please help to solve this issue

Thannk in Advance.

Expiry Date Keyboard iPhone X Layout Issue

General information

  • SDK/Library version: 5.3.0
  • Environment: Sandbox & Production
  • iOS Version and Device: 11.1.2 - iPhone X
  • Integration type and version: CocoaPods

Issue description

I see you fixed the majority of iPhone X issues raised in #62 but the expiry date custom keyboard for the drop-in UI doesn't seem to be constrained to the safe area.

See screenshot below:
braintreekeyboardissue

Venmo Authorization From Drop in UI Not Working

General information

  • SDK/Library version: Braintree = 4.9.3, Drop In = 5.2.2
  • Environment: Production
  • iOS Version and Device: iOS 11.1 / iPhone X
  • Integration type and version: CocoaPods 1.2

Issue description

Im having trouble debugging an issue where I tap Venmo in the Drop in UI, it goes to Venmo, I authorize Venmo and it appears to be successful. It then returns to my app, but it is still on the list of payment methods in the drop in UI and nothing seems to have happened. Tapping Venmo again will again take me to the Venmo app and request to authorize (did it silently fail or something?) I put a break point on the return statement here and it is triggered on returning to the app.

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
        if url.scheme?.localizedCaseInsensitiveCompare("\(Bundle.main.bundleIdentifier!).payments") == .orderedSame {
            return BTAppSwitch.handleOpen(url, options: options)
        }
}

Breakpoints in the BTDropInControllerHandlerare not though. Venmo was working for me in the Sandbox environment - when I performed this same operation it came back with the "venmojoe" user which I guess was a test.

Any help you could give me in debugging this issue would be much appreciated - thanks!

3d secure modal appears, entering verification password and then stays there.

General information

Using Braintree (4.9.6)
Using BraintreeDropIn (5.2.3)

  • Environment: Sandbox & Production
  • iOS Version and Device: iOS 11 on an iPhone 7, iPhone X, Simulator
  • Integration type and version: LATEST

Upadate:

After installed Braintree/3D-Secure i have the modal on request, i put the 1234 code, loads another page but it stays there and i don't have any control over it. Cancel not working.

Currently the App Store version uses older libraries and it works as expected, but the new builds when using a similar code like bellow, the 3d secure never appears.

func showDropIn(clientTokenOrTokenizationKey: String) {
    let request =  BTDropInRequest()
         request.threeDSecureVerification = true
         request.amount = "1.00"
    let dropIn = BTDropInController(authorization: clientTokenOrTokenizationKey, request: request)
    { (controller, result, error) in
        if (error != nil) {
            print("ERROR")
        } else if (result?.isCancelled == true) {
            print("CANCELLED")
        } else if let result = result {
            // Use the BTDropInResult properties to update your UI
            // result.paymentOptionType
            // result.paymentMethod
            // result.paymentIcon
            // result.paymentDescription
        }
        controller.dismiss(animated: true, completion: nil)
    }
    self.present(dropIn!, animated: true, completion: nil)
}

Is it an issue on latest version?
Thank you.

Cell height is too small on Select Payment Method screen

General information

  • SDK/Library version: 5.3
  • Environment: Sandbox and Production
  • iOS Version and Device: iOS 11.2.5 on iPhone 7
  • Integration type and version: Carthage 0.28

Issue description

On Select Payment Method screen cell height is smaller then it should be. It is harder for user to pick a payment method.

img_8948

BTDropInController returning BTHTTPErrorDomain code 4 (BTHTTPErrorCodeMissingBaseURL)

Developer Info

  • Braintree SDK version: 4.7.5

  • Braintree Dropin version: 5.1.0

  • Integration type and version: CocoaPods 1.2.0
  • Environment: Sandbox

Issue Details

When trying to initialize the BTDropInController with the token, I get from our server I instantly get an error. The same token is working on Android, though (tested). The Braintree test token works as expected.
My code:

let request = BTDropInRequest()
if let dropIn = BTDropInController(authorization: token, request: request, handler: { (controller, result, error) in
    if (error != nil) {
        // Error
    }
    controller.dismiss(animated: true, completion: nil)
}) {
    viewController.present(dropIn, animated: true, completion: nil)
}

The error details:

Domain=com.braintreepayments.BTHTTPErrorDomain Code=4 "(null)" UserInfo={path=v1/configuration, method=GET, parameters={
    configVersion = 3;
}}

Code 4 means:

/// The BTHTTP instance was missing a base URL
BTHTTPErrorCodeMissingBaseURL,

Comparing our token with the test token:
Our token:
image

Test token:
image

Looks like our token has a lot less information than the test token from Braintree. I'm not sure why...

When looking at the source of Braintree, I found out that Braintree tries to get the baseURL from the decoded token - BINGO:

NSURL *baseURL = [self.clientToken.json[@"clientApiUrl"] asURL];

So the problem is that our token doesn't have the clientApiUrl. If I manually insert the clientApiUrl into our token, the BTDropInController works perfectly. So the working (modified) token looks like this:
image

The question:

Why do I get such a short token - without the clientApiUrl? I don't see any settings regarding this on the Braintree admin panel. Is there any way to set the default baseURL? Why does Android work, but iOS doesn't?

iOS 8 support only for BraintreeUIKit

Hi,
I noticed that on commit f86cd05 you have support for iOS 8, Could this be return?
Or could you advice of method to use the pod without change my project min supported platform?

I need only the UI component and not all the drop-in capabilities.

Thanks,

Label change for "Scan with card.io"

Since our users aren't familiar with the name 'card.io', is it possible to change the button string "Scan with card.io" to something a little more conceptually friendly such as "Scan with camera"?

dropincontroller + 3ds

General information

  • SDK/Library version: 4.8.3
  • Environment: prod
  • iOS Version and Device: 10.3
  • Integration type and version: cocoapods 1.2.1

Issue description

Hello Support, I am using dropincontroller and trying to authorize credit card with 3ds but without success.
` BTDropInRequest *request = [[BTDropInRequest alloc] init];
request.applePayDisabled = YES;
request.currencyCode = @"GBP";
request.amount = [NSString stringWithFormat:@"£%.02f",[buyOrder getTotalAmount]];
request.threeDSecureVerification = YES;

              self.threeDSecure = [[BTThreeDSecureDriver alloc] initWithAPIClient:self.braintree delegate:self];
                

                self.dropInViewController = [[BTDropInController alloc] initWithAuthorization:clientToken request:request handler:^(BTDropInController * _Nonnull controller, BTDropInResult * _Nullable result, NSError * _Nullable error) {
                    
                    if (error != nil) {

                        [error show];
                        [self dismissDropIn];
                        
                    } else if (result.cancelled) {

                        [self dismissDropIn];
                        
                    } else {
                        
                        [BTDropInResult fetchDropInResultForAuthorization:self.clientToken handler:^(BTDropInResult * _Nullable result, NSError * _Nullable error) {
                            
                            if (error != nil) {
                                NSLog(@"%@", error.localizedDescription);
                                return;
                            }
                            
                            NSLog(@"NONCE %@", result.paymentMethod.nonce);
                            
                        }];
                        

                        [self.threeDSecure verifyCardWithNonce:result.paymentMethod.nonce amount:[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"£%.02f",[buyOrder getTotalAmount]]] completion:^(BTThreeDSecureCardNonce * _Nullable tokenizedCard, NSError * _Nullable error) {
                            
                            if (error != nil) {
                                NSLog(@"%@", error.localizedDescription);
                                return;
                            }
                            
                            NSLog(@"NONCE %@", tokenizedCard.nonce);
                            //[self collectDataForServer:tokenizedCard.nonce];
                            
                        }];

                    }
                }];

                [[self presentingViewController] presentViewController:self.dropInViewController animated:YES completion:nil];

`

Every time I am clikcing on existing card or adding new one the app crashing on braintree methods handlers (SDK methods) with error Nan write in JSON and 3ds widow not appears. What could be the issue?

Build with carthage issues

General information

  • SDK/Library version: 6.1.0
  • Environment: Sandbox
  • iOS Version and Device: iOS 11.2.6 on iPhone 8
  • Integration type and version: Carthage 0.29.0

Issue description

While trying to add Braintree support to my app i get some errors.
The first difference between the documentation and my case is that i had to add one more framework which is not listed in the minimum frameworks list stated here which is BraintreePaymentFlow.framework
The second issue i've found is that when importing Braintree using import Braintree i get
"No such module "Braintree"

Allow opt in to show Apple Pay button

Currently, you allow us to opt out of showing Apple Pay, even if it is supported by setting the following:

let request =  BTDropInRequest()
request.applePayDisabled = true // If you'd like to opt out

However, you don't seem to allow the reverse - the Apple Pay button remains hidden if the user has no cards available that support it, even if setting:

request.applePayDisabled = false

This is because in the following block of code in BTPaymentCollectionViewController.m - line 220:

#ifdef __BT_APPLE_PAY
            BTJSON *applePayConfiguration = self.configuration.json[@"applePay"];
            if ([applePayConfiguration[@"status"] isString] && ![[applePayConfiguration[@"status"] asString] isEqualToString:@"off"] && !self.dropInRequest.applePayDisabled) {
                // Short-circuits if BraintreeApplePay is not available at runtime
                if (__BT_AVAILABLE(@"BTApplePayClient") && [configuration canMakeApplePayPayments]) {
                    [activePaymentOptions addObject:@(BTUIKPaymentOptionTypeApplePay)];
                }
            }
#endif

the inner check [configuration canMakeApplePayPayments] will return false in the scenario I mention above.

It would be nice if we could force the Apple Pay button to show and then we can push the user to the 'Add Card' screen within the iOS Wallet.

This has 2 key benefits to users:

  1. It direct them immediately to the Wallet to add a card for Apple Pay if this is available.
  2. It displays to the user that our app supports Apple Pay.

Would be interested to hear any thoughts?

3DSecure will not show when using drop-in (and possible solution)

Currently 3D Secure does not seem to show when using the iOS drop-in.

The documentation advises that only the following is required to make it work:

let request =  BTDropInRequest()
request.threeDSecureVerification = true
request.amount = "1.00"

Setting request.threeDSecureVerification = true does cause the 3D checks to be started when tapping 'Add Card' in the drop-in UI, however, the loading indicator spins and then nothing happens.

Looking at the SDK code, it appears that in BTThreeDSecureDriver.m within the actual Braintree Core library, the following function is called at line 94:

[self informDelegateRequestsPresentationOfViewController:navigationController];

The function that is called (and its sibling dismiss function) both use respondsToSelector checks to make sure that the delegate does actually implement the required paymentDriver functions that are used to show the 3DS dialogue:

#pragma mark Delegate informer helpers

- (void)informDelegateRequestsPresentationOfViewController:(UIViewController *)viewController {
    if ([self.delegate respondsToSelector:@selector(paymentDriver:requestsPresentationOfViewController:)]) {
        [self.delegate paymentDriver:self requestsPresentationOfViewController:viewController];
    }
}

- (void)informDelegateRequestsDismissalOfViewController:(UIViewController *)viewController {
    if ([self.delegate respondsToSelector:@selector(paymentDriver:requestsDismissalOfViewController:)]) {
        [self.delegate paymentDriver:self requestsDismissalOfViewController:viewController];
    }
}

At this stage when using the drop-in UI, the delegate in question is an instance of BTCardFormViewController.m (since this is currently showing the 'Add Card' dialogue to the user). This class does not implement those functions and so the check fails and 3DS is never shown.

It seems to me that this should implement these functions or 3DS is never going to work in the drop-in. I have submitted a pull request the changes that I believe should fix it.

Please take a look and get back to me. Cheers! 👍

iPhone X UI Support

General information

  • SDK/Library version: 5.2.3
  • Environment: Production
  • iOS Version and Device: iOS 11.1 on an iPhone X
  • Integration type and version: CocoaPods 1.3.1

Issue description

As an iPhone X user, I'd want BTDropInController to be displayed in a safe area:

simulator screen shot - iphone x - 2017-11-16 at 18 36 31

Incorrect dismissal of BTDropInController

General information

  • SDK/Library version: 6.1.0 (but seen in earlier too)
  • Environment: Sandbox (but would apply to production)
  • iOS Version and Device: Applies to all iPhone
  • Integration type and version: Custom

Issue description

In handling errors returned from BTDropInController (for example enter a real card number when in sandbox mode) we are wanting to display UIAlertController with the error message without dismissing the BTDropInController so the user can immediately try and enter a different card.

What we are seeing is when the UIAlertController is dismissed the BTDropInController panel is animated off screen but it has not actually been dismissed. You end up with screen with translucent overlay but no BT UI to interact with and the user is stuck with no option except to forcibly terminate the app.

Looking at the code the issue is with putting the dismiss animation that removes the BTDropInController UI in an overridden version of dismissViewControllerAnimated:completion:. This method may be called to dismiss a presented (child) controller not just the instance itself and thus the animation shouldn't really be here (or this method overridden). UIAlertController calls the presenting view controller's dismissViewControllerAnimated:completion: method and thus when presented over a BTDropInController instance this issue is seen.

I would suggest that a custom presentation be built for the UI animation that is being implemented here (see UIViewControllerTransitioningDelegate) and thus leave the OS to decide when to animate the controller on and off screen. Additional benefit is you could easily then implement interactive dismissal and support swipe down gesture to remove as additional feature if desired.

Alternatively just check if [self presentedViewController] non-nil in your current implementation of dismissViewControllerAnimated:completion and if so just call through to the superclass implementation.

Before dismissal
simulator screen shot - iphone x - 2018-03-13 at 09 09 40

After dismissal - you cannot now interact with the apps UI
simulator screen shot - iphone x - 2018-03-13 at 09 09 47

Drop in UI unresponsive on tapping venmo

General information

  • SDK/Library version: Braintree = 4.9.3, Drop In = 5.2.2
  • Environment: Sandbox
  • iOS Version and Device: iOS 11
  • Integration type and version: CocoaPods 1.2

Issue description

Hi!

I have been authorized by Braintree to accept Venmo payments and have followed the integration steps outlined here: https://developers.braintreepayments.com/guides/venmo/client-side/ios/v4

When I open up the drop in UI and tap Venmo nothing happens. It just highlights the button briefly and then returns to normal. I feel like I am missing something obvious but have been over it several times with no luck. Any help I could get in debugging this would be much appreciated, thanks!

Localization on Payment Screen and Card Entry screen are cutoff or truncated

The translated strings for the payment sheet and the card entry/add screens are too long for their space and are getting cutoff and/or overlapping. It would be nice if these were exposed to the drop in controller so that we could change the font/sizing to match the application, be able to easily override the strings to our shorter ones, or if they automatically handled resizing to fix these issues.
screen shot 2017-02-13 at 3 26 13 pm
screen shot 2017-02-13 at 3 26 24 pm
screen shot 2017-02-13 at 3 26 37 pm

Block implicitly retains self

After pod update I get "Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior" x 3 in BTAPIClient.m

I'm using:

pod 'BraintreeDropIn';
pod 'Braintree/PayPal';

and in the terminal I get the following output on install:

Using Braintree (4.9.4)
Using BraintreeDropIn (5.2.3)

already tried:

pod 'BraintreeDropIn', '> 5.3.0';
pod 'Braintree', '
> 4.11.0';

but it gets other errors

Why braintree can not switch to PayPal app

General information

  • SDK/Library version: 5.2.0
  • Environment: Sandbox
  • iOS Version and Device: iOS 10.3 on an iPhone 6 Plus
  • Integration type and version: CocoaPods 1.1.1

Issue description

I just follow the guide to import braintree, but braintree always present SFSafariViewController with PayPal app installed on my iPhone. My app scheme is com.xxx.xxx.payment and I has added com.paypal.ppclient.touch.v1, com.paypal.ppclient.touch.v2, com.paypal.ppclient.touch.v3, com.venmo.touch.v2 in plist. But it seems that braintree only allow pay by SFSafariViewController not PayPal App.

BTAnalyticsMetadata.m

  • (BOOL)isPaypalInstalled {
    if ([self.class isAppExtension]) {
    return NO;
    }

    UIApplication *sharedApplication = [UIApplication performSelector:@selector(sharedApplication)];
    static BOOL paypalInstalled;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
    NSURL *paypalV1URL = [NSURL URLWithString:@"com.paypal.ppclient.touch.v1://"];
    NSURL *paypalV2URL = [NSURL URLWithString:@"com.paypal.ppclient.touch.v2://"];
    paypalInstalled = [sharedApplication canOpenURL:paypalV1URL] || [sharedApplication canOpenURL:paypalV2URL];
    });
    return paypalInstalled;
    }

PPOTCore.m

  • (BOOL)isWalletAppInstalled {
    [PPOTConfiguration updateCacheAsNecessary]; // called by all public methods

    if (iOS_9_PLUS) {
    // Don't check canOpenUrl and don't fire analytics because we can't find out if the app is installed
    return NO;
    }
    else {
    return ([PPOTAppSwitchUtil isAuthenticatorInstalledForTargetAppURLScheme:kPPOTWalletURLSchemeV1] ||
    [PPOTAppSwitchUtil isAuthenticatorInstalledForTargetAppURLScheme:kPPOTWalletURLSchemeV2] ||
    [PPOTAppSwitchUtil isAuthenticatorInstalledForTargetAppURLScheme:kPPOTWalletURLSchemeV3] );
    }
    }

Add a check to determine whether the customer added a new card or used a recent card

In the completion of the Drop-in controller it would be nice to know if the customer used a new card or a recent card. Specifically for us, this would be for use in analytics so we can see how many customers are purchasing with recent cards, but I'm sure there are other uses.

Submitting a pull request shortly showing what this change could look like.

Compile issue

BraintreeDropIn (5.3.0)
Xcode 9.2
Swift 4
Cocoapods 1.1.1
screen shot 2018-03-12 at 11 00 45 am

Facing compiling issues with Swift 4 and Xcode 9.
Easily fixable by Xcode suggestions. Please update soon if possible.. forking it for now...

Thanks

Credit card formatter is broken after edit

General information

  • SDK/Library version:"braintree/braintree-ios-drop-in" "5.2.3"
  • Environment: null
  • iOS Version and Device: all
  • Integration type and version: Carthage 0.26.2

Credit card forma is broken after editing card num, fist number in the last tuple.

credit card formatter error

Provide a way to skip the "Select Payment Method" modal if only one kind of payment available

If I am correct, there is currently no way with the newest version of the dop-in UI to skip the "Select Payment Method" modal view, even if only one method is supported by the app. It means an additional and quite unnecessary step for the user and has no advantages so it would be nice if there is a way to skip it entirely (when there are no more payment method to choose from).

Enable setting the text color for the NavigationBar and content separately

If I understood properly, the text color of the NavigationBar and the content (TextFields) can only be set to the same color (with the primaryTextColor property). It would be nice to be able to set these separately because than a dark background color for the NavigationBar and a light background color for the rest of the screen (or the other way around) can be used. I think many apps use this kind of contrast in their UI.

I hope you will add a possibility for this, thank you!

Apple Pay button should be hidden if Apple Pay payments are not possible on the device

General information

  • SDK/Library version: 5.2.0
  • Environment: Production
  • iOS Version and Device: iOS 9 +
  • Integration type and version: CocoaPods 1.2.0

Issue description

Unless you opt out, by setting showApplePayPaymentOption = false, Drop-In will show Apple Pay as a payment option as long as it is enabled in the control panel and the customer's device supports paying with your supported card networks.

--> this doesn't seem to work properly. The Apple Pay is configured, it's working on staging and on production, but the option for Apple Pay is appearing also on devices in countries, that don't support apple pay.
The work around is to exclude apple pay manually by setting BTDropInRequest.applePayDisabled (if apple pay is not supported on the device), but since the documentation is stating that this should be handled by default, this might be confusing.

PayPal Drop-In callback not called if PayPal not set up in-app but enabled in the web portal

We have implemented the Braintree Drop-In into our app, and noticed that the BTDropInController's callback function isn't called when PayPal isn't set up in-app but is selected as the payment type. The callback could be necessary (and is for us) if we enabled PayPal on our portal for Web transactions but not for our mobile platform. In this case, we want the callback so we can show a pop up saying 'Coming soon'.

Select Payment UI Problem.

General information

  • SDK/Library version: latest version
  • Environment: Sandbox
  • iOS Version and Device: any iOS
  • Integration type and version:

Issue description

Select Payment UI Problem.

screen shot 2018-04-25 at 12 43 48 am

Drop-in does not forward appearance properties to Card.io

General information

  • SDK/Library version: latest
  • Environment: *
  • iOS Version and Device: *
  • Integration type and version: *

Issue description

Referred by @mwoollard from this Card.io issue

We need to proxy the navigation bar color from UIAppearance to CardIOPaymentViewController

- (void)presentCardIO {
    Class kCardIOPaymentViewController = NSClassFromString(@"CardIOPaymentViewController");
    id scanViewController = [[kCardIOPaymentViewController alloc] initWithPaymentDelegate:self];
    [scanViewController setNavigationBarTintColor:[[UINavigationBar appearance] barTintColor]]; // add this line
    [scanViewController setHideCardIOLogo:YES];
    [scanViewController setCollectCVV:NO];
    [scanViewController setCollectExpiry:NO];
    [self presentViewController:scanViewController animated:YES completion:nil];
}

Build error

/Users/Pods/Braintree/BraintreeCore/BTAPIClient.m:190:45: Object of type 'NSNumber *' is not compatible with dictionary value type 'NSString *'

190 line: -> parameters:@{@"default_first": @(defaultFirst),

Detect when 'Add Card' view controller opens so that status bar color can be changed

Moved from braintree_ios issue tracker.

Currently, when the 'Add Card' view controller is presented when using the drop-in UI, there seems to be no way to detect that this has shown, and this means that if using the default light theme, if using a white status bar style, it cannot be seen since it blends in with the nav bar.

I know you also offer a dark theme but it seems like there should either be a way of being notified that the 'Add Card' flow has opened so we can change the status bar style ourselves manually, or in the drop-in framework, maybe in the BTUIKAppearance customisation options, an option should be given to set the status bar style.

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.