Giter VIP home page Giter VIP logo

braintree_ios's Introduction

Braintree iOS SDK

CocoaPods compatible Swift Package Manager compatible Carthage compatible

GitHub Actions Tests

Welcome to Braintree's iOS SDK. This library will help you accept card and alternative payments in your iOS app.

v6 is the latest major version of Braintree iOS. To update from v5, see the v6 migration guide. If you have not yet migrated to v5, see the v5 migration guide

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

Supported Payment Methods

Installation

We recommend using Swift Package Manager, CocoaPods, or Carthage to integrate the Braintree SDK with your project.

Swift Package Manager

This feature is only available in v5+.

To add the Braintree package to your Xcode project, select File > Swift Packages > Add Package Dependency and enter https://github.com/braintree/braintree_ios as the repository URL. Tick the checkboxes for the specific Braintree libraries you wish to include.

If you look at your app target, you will see that the Braintree libraries you chose are automatically linked as a frameworks to your app (see General > Frameworks, Libraries, and Embedded Content).

BraintreePayPal and BraintreePaymentFlow also require the inclusion of the PayPalDataCollector module.

In your app's source code files, use the following import syntax to include Braintree's libraries:

import BraintreeCore
import BraintreeCard
import BraintreeApplePay
import BraintreePayPal

CocoaPods

# Includes Cards and PayPal
pod 'Braintree'

# Optionally include additional Pods
pod 'Braintree/DataCollector'
pod 'Braintree/Venmo'

Carthage

Braintree 6.0.0+ requires Carthage 0.38.0+ and the --use-xcframeworks option when running carthage update.

Add github "braintree/braintree_ios" to your Cartfile, and add the frameworks to your project.

Note: Long term support for Carthage is not guaranteed. Please update to SPM, if possible. If there are concerns, please comment on this Discussion thread.

Documentation

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

Next, read the full documentation for information about integrating with additional payment methods, such as PayPal and Venmo, as well as explore our pre-built Drop-In UI offering.

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
6.x.x Active June 2023 TBA TBA
5.x.x Inactive February 2021 June 2024 June 2025
4.x.x Unsupported November 2015 February 2022 February 2023

Versions 4.9.6 and below use outdated SSL certificates and are unsupported.

Demo

  1. Run pod install
    • There is a known M1 mac issue with CocoaPods. See this solution to resolve ffi dependency issues.
  2. Resolve the Swift Package Manager packages if needed: File > Packages > Resolve Package Versions or by running swift package resolve in Terminal
  3. Open Braintree.xcworkspace in Xcode
  4. Select the Demo scheme, and then run

Xcode 15.0+ is required to run the demo app.

Contributing

We welcome PRs to this repo. See our development doc.

Feedback

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

Here are a few ways to get in touch:

Help

License

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

braintree_ios's People

Contributors

agedd avatar andrespelaezp avatar ayanonagon avatar billwerges avatar braintreeps avatar burnto avatar crookedneighbor avatar demerino avatar eventomer avatar intelliot avatar jackellenberger avatar jaxdesmarais avatar jonathajones avatar kunjeongpark avatar lkorth avatar mattwylder avatar mickeyreiss avatar nmehtapp avatar nudge avatar reflejo avatar rksaraf avatar sarahkoop avatar scannillo avatar sergey-sportsetter avatar sestevens avatar skunkworks avatar sshropshire avatar stechiu avatar theill avatar warmkesselj 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  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  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's Issues

Calling cardEntry on BTPaymentForm causes an NSRangeException if monthYearTextField not set

Hi,

Not sure if I'm supposed to call hasValidCardEntry before calling cardEntry (which is the workaround) however, if I call cardEntry without checking hasValidCardEntry and the monthYearTextField isn't set then this code causes an NSRangeException due to the textfield.text length is zero.

- (NSString *)monthExpirationEntry {
    return [monthYearTextField.text substringToIndex:2];
}

Maybe use the same check you have in hasValidCardEntry first, i.e.

- (NSString *)monthExpirationEntry {
    if (monthYearTextField.text.length != 5)
        return nil;
    return [monthYearTextField.text substringToIndex:2];
}

same for yearExpirationEntry obviously.

On a somewhat related note, in the cardEntry function you are adding the items to the NSMutableDictionary if they are not nil (e.g. if (cardNumber) [cardEntryDictionary setObject:cardNumber forKey:@"card_number"]). However you are not returning nil in the event of invalid entries. For example, your formatNumberForComputing function will return @"" if the card number is empty, not nil. Is that the intended behaviour?

Hope helpful,

Charles.

iOS 8 deprecation issues

The iOS sdk fails to compile in iOS 8 due to deprecation issues within the BTAnalyticsMetadata.m class. I have tested this on Xcode 6 beta 4 and beta 6. The exact errors that I am getting are "'kCLAuthorizationStatusAuthorized' is deprecated" and "'interfaceOrientation' is deprecated". Thanks in advance for your help!

Garbage operands in NSData+Base64 category

If you let Xcode to an analysis of the Braintree repo it'll complain over two logic errors in NSData+Base64.m, lines 75 & 76.

To be honest I'm not entirely sure of what goes on, the suspected code is only run when ixinbuf is 4 and by that time the contents of inbuf should perhaps not be garbage since it's set in previous iterations of the loop. The entire code is a bit murky.

Either way it would be nice to not have Xcode complain over things.

Braintree payment issue

I am using Braintree payment version 3.1.0 . We successfully integrated into our project(IOS application) ,while doing Payment using credit card didSucceedWithPaymentMethod: is called but we are unable to check-in transaction in Braintree website (in Transactions summary).

  • (void)informDelegateDidAddPaymentMethod:(BTPaymentMethod *)paymentMethod {

if ([self .delegate
respondsToSelector:@selector(dropInViewController:didSucceedWithPaymentMethod:)])
{

[self.delegate dropInViewController:self

didSucceedWithPaymentMethod:paymentMethod];

}

}

  • (void)dropInViewController:(BTDropInViewController *)viewController
    didSucceedWithPaymentMethod:(BTPaymentMethod *)paymentMethod {

[viewController.navigationController dismissViewControllerAnimated:YES
completion:nil];

NSMutableArray *newPaymentMethods = [NSMutableArray arrayWithArray:self.
paymentMethods];

[newPaymentMethods insertObject:paymentMethod atIndex:0];

self.paymentMethods = newPaymentMethods;

}
We are able to get card details in BTPaymentMethod but we are unable to see transaction in braintree website.

How to know whether payment is success or not?

If the payment is not success then is there any delegate method to find out the error ?

Can you please help me to proceed further.

List of bundled third party open source code

The SDK documentation should include a list of all bundled open source software. Apps that use the Braintree SDK include copies of this third-party software and attribution may be required to comply with the various open source licenses. For example, I believe both 1Password and card.io have an MIT license, which requires a copyright notice to be included in all copies.

en_UK is not actually a localization

It appears you need to delete your en_UK localization folder - I see you've already added an en_GB localization, which is the correct code, but it looks like not removing en_UK produces this warning when validating a binary compiled with the current SDK:

en_uk_nope

This does not prevent binaries from being submitted (at least for TestFlight Neue - I haven't tried a full App Store submission yet), it just generates that warning.

BTPaymentButton requires auto layout

There are two known issues with BTPaymentButton:

  • auto-layout is required
    • A workaround for apps that do not use auto-layout:
NSDictionary *views = @{ paymentButton: self.paymentButton };
[self addConstraint:[NSLayoutConstraint constraintsWithVisualFormat:@"[paymentButton(==200)]" options:0 metrics:nil views:views]];
[self addConstraint:[NSLayoutConstraint constraintsWithVisualFormat:@"[paymentButton(==200)]" options:0 metrics:nil views:views]];
  • *negative or zero item sizes are not supported in the flow layout* appears in the Xcode console
    • I believe this console line is harmless.
    • It is caused by an invalid state that occurs transiently during initialization, in which the underlying UICollectionView has CGSizeZero item size.

We intend to fix these bugs in the near future.

iOS 8 deprecation error on physical device

When attempting to compile for a physical device in Xcode 6 Beta 6 and iOS 8 Beta I get the following error for BTAnalyticsMetadata.m:
"'system' is deprecated: first deprecated in iOS 8.0 - Use posix_spawn APIs instead." (coming from (Bool)deviceRooted method)

Getting an unrecognised selector crash using the Paypal button

I'm initting a Paypal button with a valid client token, however it's immediately causing an app crash

- (void)setupPaypalButton {
    paypalButton = [self.braintree payPalButtonWithDelegate:self];
    [paypalButton setFrame:CGRectMake(0, 0, self.paypalButtonView.frame.size.width, self.paypalButtonView.frame.size.width)];
    [self.paypalButtonView addSubview:paypalButton];
    [self.paypalButtonView bringSubviewToFront:paypalButton];
}

Causes this exception:
-[BTClient btPayPal_isPayPalEnabled]: unrecognized selector sent to instance
Appears to be an issue in the payPalButtonWithDelegate method in Braintree.m (line 77)

This has me pretty damn worried as I certainly can't be using a lib that's tripping an exception on init!

64 bit support

Looking for 64 bit support to build 64 bit apps on the iPhone 5S/iPad Air.

Can't customize 'Use Card Button'

I am trying to change the color of use card button from blue to red.

self.paymentViewController =
[BTPaymentViewController paymentViewControllerWithVenmoTouchEnabled:YES];
self.paymentViewController.delegate = self;
self.paymentViewController.cardView.useCardButtonBackgroundColor = [UIColor redColor];

It has no effect. The button stays blue.

Apple Pay entitlement is required even when not used

Using Braintree 3.4.0, v.zero drop-in UI

Upon submission to Apple, got the message:

App contains references to [Apple Pay] in 'SportSetter', but is missing the required entitlement '.com.apple.developer.in-app-payments'

Previously, this entitlement was not necessary

Support simulation of PayPal One Touch errors via fake-wallet

This is the URL that's generated when I press the PayPal button (I'm currently testing on the simulator with the fake-wallet app):

com.paypal.ppclient.touch.v1://authenticate?payload=redacted&x-source=com.redacted&x-success=com.redacted.payments://success&x-cancel=com.redacted.payments://cancel

Cant find library 'lPayPalMobile'

Ive installed Braintree 3.5.0 via cocoapods and when I Profile (cmd) + i I get an Apple Mach-O Linker Error saying: library not found for -lPayPalMobile

Ive checked throught the build settings and everything looks right but the error is still there :(

3.4.0-rc1 build fails at BTDropInViewController.m:306

I'm seeing this build error:

/Braintree/Braintree/Drop-In/Braintree-Drop-In/BTDropInViewController.m:306:36: error: incompatible pointer to integer conversion assigning to 'BOOL' (aka 'signed char') from 'NSNumber *' [-Werror,-Wint-conversion]
            request.shouldValidate = @YES;
                                   ^ ~~~~

Looks like shouldValidate is defined as a BOOL, not an NSNumber.

can't locate file for: -lPods

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods is not an object file (not allowed in a library)

Not able to run the project .This occurs under Pods-Braintree.

Can't add credit cards with 2.2.x

When I submit encrypted credit card info to the braintree sandbox (via my rails server), it is rejected with a whole bunch of validation errors:

{"cvv":["CVV must be 4 digits for American Express and 3 digits for other card types."],
"expiration_year":["Expiration year is invalid."],
"expiration_month":["Expiration month is invalid."],
"number":["Credit card type is not accepted by this merchant account.","Credit card number must be 12-19 digits."],
"postal_code":["Postal code can only contain letters, numbers, spaces, and hyphens.","Postal code may contain no more than 9 letter or number characters."]}

Rolling my BTEncryption.m code back to the 2.1.2 version fixes the issue. Any ideas why Braintree is rejecting the encrypted data?

armv7 symbols missing

Hey guys,

it seems some armv7 symbols are missing from the following classes:
screenshot 2014-07-31 12 53 22

I'm using Clang 6, Braintree SDK 3.1.0

Crasher: Drop In > Payment Button > Retry

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BTPaymentButton sendActionsForControlEvents:]: unrecognized selector sent to instance 0x14ec38a0'

Description

This exception is thrown when the user taps on a payment option above the card form in BTDropInViewController and an error (e.g. network error) occurs. When Drop In receives an error, the user is given a choice via a UIAlertView to "Cancel" or "Retry". If the user taps "Retry", an exception is thrown in the most recent release, 3.3.0.

Temporary Workaround

Modify BTDropInViewController to remove retry logic for Drop In:

diff --git a/Braintree/Drop-In/Braintree-Drop-In/BTDropInViewController.m b/Braintree/Drop-In/Braintree-Dr
op-In/BTDropInViewController.m                                                                            
index 7ccf475..0743d9a 100644                                                                             
--- a/Braintree/Drop-In/Braintree-Drop-In/BTDropInViewController.m                                        
+++ b/Braintree/Drop-In/Braintree-Drop-In/BTDropInViewController.m                                        
@@ -441,11 +441,7 @@                                                                                      
             // Use the paymentMethods setter to update state                                             
             [self setPaymentMethods:_paymentMethods];                                                    
             self.savePayPalAccountErrorAlert = nil;                                                      
-        } retry:^{                                                                                       
-            [sender sendActionsForControlEvents:UIControlEventTouchUpInside];                            
-            [self setPaymentMethods:_paymentMethods];                                                    
-            self.savePayPalAccountErrorAlert = nil;                                                      
-        }];                                                                                              
+        } retry:nil];                                                                                    
         self.savePayPalAccountErrorAlert.title = savePaymentMethodErrorAlertTitle;                       
         [self.savePayPalAccountErrorAlert show];                                                         
     }                                                                                                    

Technical Explanation

When the user taps "Retry" after Drop In fails, Drop In performs retry by emulating a tap on the payment button, as if the user tapped it again, by sending the button sendActionsForControlEvents:. Before 3.3.0, the payment button could only be a BTPayPalButton, which was a subclass of UIControl. In 3.3.0, the button is now a BTPaymentButton, which is a UIView subclass. Since BTPaymentButton does not respond to sendActionsForControlEvents:, the runtime throws an exception in this case.

Full stack trace

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BTPaymentButton sendActionsForControlEvents:]: unrecognized selector sent to instance 0x14ec38a0'

Last Exception Backtrace:
0   CoreFoundation                       0x2e703ecb __exceptionPreprocess + 131
1   libobjc.A.dylib                      0x38e9ece7 objc_exception_throw + 36
2   CoreFoundation                       0x2e7077f7 -[NSObject(NSObject) doesNotRecognizeSelector:] + 200
3   CoreFoundation                       0x2e7060f7 ___forwarding___ + 704
4   CoreFoundation                       0x2e655058 _CF_forwarding_prep_0 + 22
5   Braintree-Demo                       0x001b8403 __64-[BTDropInViewController paymentMethodCreator:didFailWithError:]_block_invoke349 (BTDropInViewController.m:445)
6   Braintree-Demo                       0x001b3cd3 -[BTDropInErrorAlert alertView:clickedButtonAtIndex:] (BTDropInErrorAlert.m:47)
7   UIKit                                0x3114c209 -[_UIModalItemsCoordinator _notifyDelegateModalItem:tappedButtonAtIndex:] + 142
8   UIKit                                0x3114bedb -[_UIModalItemAlertContentView tableView:didSelectRowAtIndexPath:] + 376
9   UIKit                                0x310537d3 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1076
10  UIKit                                0x31105c93 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 212
11  UIKit                                0x30fb4de9 _applyBlockToCFArrayCopiedToStack + 314
12  UIKit                                0x30f2db37 _afterCACommitHandler + 428
13  CoreFoundation                       0x2e6ceff9 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
14  CoreFoundation                       0x2e6cc987 __CFRunLoopDoObservers + 284
15  CoreFoundation                       0x2e6cccd3 __CFRunLoopRun + 736
16  CoreFoundation                       0x2e637729 CFRunLoopRunSpecific + 522
17  CoreFoundation                       0x2e63750b CFRunLoopRunInMode + 104
18  GraphicsServices                     0x335a66d3 GSEventRunModal + 136
19  UIKit                                0x30f98871 UIApplicationMain + 1134
20  Braintree-Demo                       0x0004b3d3 main (main.m:8)
21  libdyld.dylib                        0x3939cab7 start + 0

Fix in 3.3.1

A bugfix will be released in version 3.3.1, during the week of 9/15/14.

Included Paypal SDK causes build failures for armv7 architecture

I've got a pretty standard setup - see below for my Podfile - it seems as though the included version of the Paypal SDK doesn't support armv7

Podfile:

platform :ios, '7'

pod 'Braintree'
pod 'GoogleAnalytics-iOS-SDK'

Compile errors:

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_PayPalConfiguration", referenced from:
      objc-class-ref in libPods.a(BTClientToken+BTPayPal.o)
  "_PayPalEnvironmentNoNetwork", referenced from:
      -[BTClient(BTPayPal) btPayPal_preparePayPalMobileWithError:] in libPods.a(BTClient+BTPayPal.o)
  "_PayPalEnvironmentProduction", referenced from:
      -[BTClient(BTPayPal) btPayPal_preparePayPalMobileWithError:] in libPods.a(BTClient+BTPayPal.o)
      -[BTClient(BTPayPal) btPayPal_applicationCorrelationId] in libPods.a(BTClient+BTPayPal.o)
  "_OBJC_CLASS_$_PayPalFuturePaymentViewController", referenced from:
      objc-class-ref in libPods.a(BTClient+BTPayPal.o)
  "_PayPalEnvironmentSandbox", referenced from:
      -[BTClient(BTPayPal) btPayPal_applicationCorrelationId] in libPods.a(BTClient+BTPayPal.o)
  "_OBJC_CLASS_$_PayPalMobile", referenced from:
      objc-class-ref in libPods.a(BTClient+BTPayPal.o)

Using my own Merchant ID and CSE

Hello,

i was wondering what were the steps that i should make, so that i can use Sample Checkout and see the results on my Sandbox account. I tried to simply put my own Merchant ID and CSE but that did not work. Any ideas?

Cheers

Sample Project doesn't compile under Xcode 5 with iOS 7

Ld /Users/stevemoser/Library/Developer/Xcode/DerivedData/braintree_ios-crcknsffbpbrckgoomwrztkkxnmt/Build/Intermediates/braintree_ios.build/Debug-iphoneos/SampleCheckout.build/Objects-normal/armv7/SampleCheckout normal armv7
cd /Users/stevemoser/Downloads/braintree_ios-master/braintree
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /SDKs/iPhoneOS7.0.sdk -L/Users/stevemoser/Library/Developer/Xcode/DerivedData/braintree_ios-crcknsffbpbrckgoomwrztkkxnmt/Build/Products/Debug-iphoneos -F/Users/stevemoser/Library/Developer/Xcode/DerivedData/braintree_ios-crcknsffbpbrckgoomwrztkkxnmt/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Users/stevemoser/Downloads/braintree_ios-master/braintree/../venmo-touch -filelist /Users/stevemoser/Library/Developer/Xcode/DerivedData/braintree_ios-crcknsffbpbrckgoomwrztkkxnmt/Build/Intermediates/braintree_ios.build/Debug-iphoneos/SampleCheckout.build/Objects-normal/armv7/SampleCheckout.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=5.0 -framework AdSupport -framework CoreTelephony -framework CoreText -framework VenmoTouch -framework UIKit -framework QuartzCore -framework Security -framework Foundation -framework CoreGraphics -Xlinker -dependency_info -Xlinker /Users/stevemoser/Library/Developer/Xcode/DerivedData/braintree_ios-crcknsffbpbrckgoomwrztkkxnmt/Build/Intermediates/braintree_ios.build/Debug-iphoneos/SampleCheckout.build/Objects-normal/armv7/SampleCheckout_dependency_info.dat -o /Users/stevemoser/Library/Developer/Xcode/DerivedData/braintree_ios-crcknsffbpbrckgoomwrztkkxnmt/Build/Intermediates/braintree_ios.build/Debug-iphoneos/SampleCheckout.build/Objects-normal/armv7/SampleCheckout

Undefined symbols for architecture armv7:
"OBJC_CLASS$_VTClient", referenced from:
objc-class-ref in SCAppDelegate.o
objc-class-ref in SCViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Can't validate card without ZIP codes, despite setting requestsZip to NO.

So, heh, I think I found something interesting in the 2.2.x releases.

hasValidCardEntry in BTPaymentFormView now ignores the requestsZip flag, which means that you no longer can validate cards without a ZIP code.

Previously in 2.1.x the check was:
if ((_requestsZip && zipTextField.text.length == 5) || !_requestsZip)

Now it's just:
if ([self validateZipCode:zipTextField.text])

The validatesZipCode method doesn't care about the requestsZip flag either. I think you guys should use git blame and have that person buy the entire team and me beer.

American Express Cards are cut off in BTDropInSelectPaymentMethodViewController

ios simulator screen shot jan 9 2015 3 12 27 pm

Reproduction steps:

  • Open BTDropInViewController for an account with several credit cards in the vault, including an American Express
  • Select "Change payment method"
  • The last two digits of the card are not visible when shown in the list

Is there a way I can override the localized strings in my application to change the display to Amex? It looks like BTUILocalizedString will only look in the Braintree-UI-Localization bundle.

Due to differences in the margin of the card graphic, the text is not cut off in BTDropInViewController itself when showing a single payment method.

Issue using PayPal button with Xcode 6 GM

I'm getting an assertion error immediately after authorising PayPal via the BTPayPalButton- not changed any code at all since I was using Xcode 5 (compiling against 7.1) - this is now against the 8.0 GM SDK

See below for stack trace:

2014-09-11 16:52:17.011 XXXXXX[28707:927349] *** Assertion failure in -[UITableView _classicHeightForRowAtIndexPath:], /SourceCache/UIKit_Sim/UIKit-3318/UITableView.m:10772
2014-09-11 16:52:28.287 XXXXXX[28707:927349] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid row height provided by table delegate. Value must be greater than zero or UITableViewAutomaticDimension.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010b6863f5 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010b31bbb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010b68625a +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x000000010af3928f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
    4   UIKit                               0x0000000109cd62f8 -[UITableView _classicHeightForRowAtIndexPath:] + 353
    5   UIKit                               0x0000000109cd64ac -[UITableView _heightForCell:atIndexPath:] + 146
    6   UIKit                               0x0000000109cc8f07 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 1917
    7   UIKit                               0x0000000109c49eae +[UIView(Animation) performWithoutAnimation:] + 65
    8   UIKit                               0x0000000109cc877b -[UITableView _configureCellForDisplay:forIndexPath:] + 312
    9   UIKit                               0x0000000109ccfcec -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 533
    10  UIKit                               0x0000000109caf7f1 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2846
    11  UIKit                               0x0000000109cc565c -[UITableView layoutSubviews] + 213
    12  UIKit                               0x0000000109c52199 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
    13  QuartzCore                          0x0000000109a64f98 -[CALayer layoutSublayers] + 150
    14  QuartzCore                          0x0000000109a59bbe _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    15  QuartzCore                          0x0000000109a59a2e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    16  QuartzCore                          0x00000001099c7ade _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
    17  QuartzCore                          0x00000001099c8bea _ZN2CA11Transaction6commitEv + 390
    18  QuartzCore                          0x00000001099c9255 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
    19  CoreFoundation                      0x000000010b5bb347 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    20  CoreFoundation                      0x000000010b5bb2a0 __CFRunLoopDoObservers + 368
    21  CoreFoundation                      0x000000010b5b10d3 __CFRunLoopRun + 1123
    22  CoreFoundation                      0x000000010b5b0a06 CFRunLoopRunSpecific + 470
    23  GraphicsServices                    0x000000010c0c69f0 GSEventRunModal + 161
    24  UIKit                               0x0000000109bd9550 UIApplicationMain + 1282
    25  Massage STG                         0x0000000106202743 main + 115
    26  libdyld.dylib                       0x000000010bd0f145 start + 1
)
    libc++abi.dylib: terminating with uncaught exception of type NSException

plist file issue (pods)

When i'm running following code:

[VTClient
startWithMerchantID:BraintreeMerchantID
customerEmail:nil
braintreeClientSideEncryptionKey:config.cseKey
environment:VTEnvironmentSandbox];
i'm having this error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Given path did not point to a valid plist for initializing the default configuration.'

Add to Cocoapods repo

Possible to get braintree_ios added to the Cocoapods repo? Now that there's a pod spec, it works well as a pod. However, you can't version lock the pod when targeting a git repo, so you can't version lock the app and upgrade the framework at your own choosing.

Crash in BTPaymentFormView

I got a crash reported: -[__NSCFString replaceCharactersInRange:withString:]: Range or index out of bounds

0   CoreFoundation  <redacted> + 130    
1   libobjc.A.dylib objc_exception_throw + 38   
2   CoreFoundation  <redacted> + 0  
3   CoreFoundation  <redacted> + 222    
4   Foundation  <redacted> + 134    
5   Vint    -[BTPaymentFormView cardNumberTextFieldShouldChangeCharactersInRange:replacementString:] (BTPaymentFormView.m:264) + 1702857    
6   Vint    -[BTPaymentFormView textField:shouldChangeCharactersInRange:replacementString:] (BTPaymentFormView.m:225) + 1702053 
7   UIKit   <redacted> + 88 
8   UIKit   <redacted> + 48 
9   UIKit   <redacted> + 98 
10  UIKit   <redacted> + 236    
11  Foundation  <redacted> + 250    
12  Foundation  <redacted> + 454    
13  UIKit   <redacted> + 142    
14  UIKit   <redacted> + 144    
15  UIKit   <redacted> + 1000   
16  UIKit   <redacted> + 1078   
17  UIKit   <redacted> + 214    
18  UIKit   <redacted> + 316    
19  UIKit   <redacted> + 430    
20  CoreFoundation  <redacted> + 20 
21  CoreFoundation  <redacted> + 284    
22  CoreFoundation  <redacted> + 730    
23  CoreFoundation  CFRunLoopRunSpecific + 522  
24  CoreFoundation  CFRunLoopRunInMode + 106    
25  GraphicsServices    GSEventRunModal + 138   
26  UIKit   UIApplicationMain + 1136    
27  Vint    main (main.m:15) + 379991   
28  libdyld.dylib   <redacted> + 2

Venmo touch compile error

I have successfully installed braintree ios sdk using cocoapod and It was compiled fine.
However, when I initVTClient in my appdelegate.m file. I was getting compiling error:
Undefined symbols for architecture i386:
"OBJC_CLASS$_VTClient", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

and I couldn't find any solutions online at all. any tips?

crashes in venmo

I see some unhanded exceptions in our logs

Thread : Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x30897e83 exceptionPreprocess + 130
1 libobjc.A.dylib 0x3abf46c7 objc_exception_throw + 38
2 CoreFoundation 0x30897d55 +[NSException raise:format:]
3 Foundation 0x312400af -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 90
4 YPlan 0x0006a4cd -VTFSNConnection failWithError:
5 YPlan 0x0006ae13 -VTFSNConnection didExpireInBackground
6 UIKit 0x3302178d -[UIApplication handleEvent:withNewEvent:] + 2508
7 UIKit 0x33020cfd -[UIApplication sendEvent:] + 72
8 UIKit 0x33086321 _UIApplicationHandleEvent + 664
9 GraphicsServices 0x3550676d _PurpleEventCallback + 608
10 CoreFoundation 0x30862f1f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 14
11 CoreFoundation 0x3086246d __CFRunLoopDoSources0 + 340
12 CoreFoundation 0x30860bd7 __CFRunLoopRun + 630
13 CoreFoundation 0x307cb471 CFRunLoopRunSpecific + 524
14 CoreFoundation 0x307cb253 CFRunLoopRunInMode + 106
15 GraphicsServices 0x355052eb GSEventRunModal + 138
16 UIKit 0x33080845 UIApplicationMain + 1136
17 YPlan 0x00065fe7 main (main.m:20)
18 libdyld.dylib 0x3b0edab7 start + 2

Apple Pay: Crash in PKPayment dealloc in 3.4.0-rc3

I'm seeing an intermittent crash in [PKPayment dealloc]. Example:

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x39a63f56 objc_msgSend + 21
1  CoreFoundation                 0x2c156e5d CFRelease + 600
2  PassKitCore                    0x34bcc9b5 -[PKPayment dealloc] + 104
3  libobjc.A.dylib                0x39a71d5f objc_object::sidetable_release(bool) + 166
4  MyApp                          0x0047f163 __destroy_helper_block_268 (BTClient.m)
5  libsystem_blocks.dylib         0x39ff2ae1 _Block_release + 216
6  MyApp                          0x004976f5 __destroy_helper_block_138 (BTHTTP.m)
7  libsystem_blocks.dylib         0x39ff2ae1 _Block_release + 216
8  libdispatch.dylib              0x018be9c7 _dispatch_client_callout + 22
9  libdispatch.dylib              0x018c23ed _dispatch_main_queue_callback_4CF + 808
10 CoreFoundation                 0x2c2159d1 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
11 CoreFoundation                 0x2c2140d1 __CFRunLoopRun + 1512
12 CoreFoundation                 0x2c162211 CFRunLoopRunSpecific + 476
13 CoreFoundation                 0x2c162023 CFRunLoopRunInMode + 106
14 GraphicsServices               0x335150a9 GSEventRunModal + 136
15 UIKit                          0x2f76e1d1 UIApplicationMain + 1440
16 MyApp                          0x000c9e45 main (main.m:16)

I've looked into it and I think this is related to how BTApplePayPaymentMethod is managing its ABRecordRef pointers for billingAddress and shippingAddress. Specifically, its copy method assigns to the new objects directly without incrementing their reference counts. Therefore, when the original object is dealloc'd, the ABRecordRefs can be freed, and when the copied object is dealloc'd there is a crash.

Here is some sample code to reproduce the crash:

ABRecordRef CreateAddress()
{
    // Mostly copied from Apple sample code

    ABRecordRef person = ABPersonCreate();

    ABMutableMultiValueRef address = ABMultiValueCreateMutable(kABDictionaryPropertyType);

    // Set up keys and values for the dictionary.
    CFStringRef keys[3];
    CFStringRef values[3];
    keys[0] = kABPersonAddressStreetKey;
    keys[1] = kABPersonAddressCityKey;
    keys[2] = kABPersonAddressStateKey;
    values[0] = CFSTR("1234 Laurel Street");
    values[1] = CFSTR("Atlanta");
    values[2] = CFSTR("GA");

    CFDictionaryRef aDict = CFDictionaryCreate(
                                               kCFAllocatorDefault,
                                               (void *)keys,
                                               (void *)values,
                                               3,
                                               &kCFCopyStringDictionaryKeyCallBacks,
                                               &kCFTypeDictionaryValueCallBacks
                                               );

    // Add the street address to the multivalue.
    ABMultiValueIdentifier identifier;
    bool didAdd;
    didAdd = ABMultiValueAddValueAndLabel(address, aDict, kABHomeLabel, &identifier);
    if (!didAdd) {/* Handle error here. */}
    CFRelease(aDict);

    /* ... Do something with the multivalue, such as adding it to a person record. ...*/
    CFErrorRef errorRef;
    ABRecordSetValue(person, kABPersonAddressProperty, address, &errorRef);

    CFRelease(address);

    return person;
}

void test() {
    id applePayMethod = [[BTApplePayPaymentMethod alloc] init];
    ABRecordRef record = CreateAddress(); // record retain count is 1
    [applePayMethod setBillingAddress:record]; // retain count is incremented to 2
    CFRelease(record); // retain count is decremented to 1
    id copy = [applePayMethod copy]; // the original billing address is copied
    applePayMethod = nil; // the address retain count is 0
    copy = nil; // crashes as this calls release on billingAddress
}

Invalid property declaration

Hey guys,

there's been a problem with one of the property names used in BTPaymentMethod_Mutable.h
It causes the following error:

screenshot 2014-07-30 20 17 42

Using Clang 6, Braintree SDK 3.1.0

Credit card shown for wrong users in iOS app

I have an iOS app with multiple users, if user A saves a credit card after a payment is made then he logout, if user B logs in the credit card user A entered earlier is available to user B and this is not accepted.
How can i keep the cards separated for each user?
I have created the VTClient in app delegate using merchant id and client encryption key (and nil email).
Then i presented the BTPaymentViewController and used the 2 delegate method: didSubmitCardWithInfo and didAuthorizeCardWithPaymentMethodCode to received new and already used credit card.
In both methods the dictionary is sent to the server and a customerId created using [[UIDevice currentDevice] identifierForVendor].UUIDString is added to the card dictionary (added using customer_id key).
Are the credit cards made available based on this UUID customer_id? should i compose a static string + unique usernames here instead UUID?

Please help.

How can I stylize BTPayPalViewController?

I'm presenting the controller like so:

BTClient *braintreeClient = [[BTClient alloc] initWithClientToken:self.braintreeToken];
_adapter = [[BTPayPalAdapter alloc] initWithClient:braintreeClient];
_adapter.delegate = self;
[self.adapter initiatePayPalAuth];
- (void)payPalAdapter:(BTPayPalAdapter *)payPalAdapter requestsPresentationOfViewController:(UIViewController *)viewController
{
    [self presentViewController:viewController animated:YES completion:nil];
}

However, due to my previous UIAppereance settings, the nav bar buttons are white on a white nav bar, so they are invisible.

What's the best way to stylize this controller?

iOS 8 issue

The latest Braintree SDK (3.1.2) will not compile under the iOS 8 SDK. The problem seems to be that the class BTPaymentMethod_Mutable defines a “description” property that is declared as readwrite and conflicts with the underlying description property on NSObject.

If I comment out the #import statement in BTPaymentMethod.m where it imports BTPaymentMethod_Mutable, my app will then compile, but then I get a runtime error after using the drop in view controller and attempting to add a credit card. Also, the drop in controller seems to have broken layout constraints under iOS 8.

deleteBackward isn't called in iOS8

For some reason method - (void)deleteBackward in your in BTUITextField doesn't get called on iOS8 only (iOS7 works just fine). Thus resulting in delegate methods not getting called (textFieldWillDeleteBackward:, textFieldDidDeleteBackward:originalText:).
This leads to a bug, where user can't delete a backslash in BTUICardExpiryField.

The Latest version has no support iOS 6

Currently, we are building the app with Braintree, Our app has minimum support iOS 6. so it would not working with the latest SDK which has minimum support iOS 7. So the question is, will the 2.2.8 version still support with Braintree server?

Memory leak of cipherTextBuf in BTRSA?

If tell Xcode to analyse the Braintree repo it warns of a potential memory leak on line 51 in BTRSA.m.

The relevant lines:
cipherTextBuf = malloc(cipherTextSize);
...
return [[NSData alloc] initWithBytes: cipherTextBuf length:cipherTextSize];

So, it seems as if cipherTextBuf is never released and is thus leaked. Not a big leak, but something that should be fixed.

XCode 5 braintree_iOS issue

braintress_ios xcode5 issue
Braintree_iOS was running fine with Xcode 4.6.3 but I am using this is on XCode 5 and it is crashing.
I am using Braintree_iOS samplcheckout on Xcode 5, it is running fine but when I am using this on other project, it is crashing XCODE 5.0

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.