Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Update braintree dropin version #4

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5377609
Update README.md
mihailox Jan 19, 2021
2dbfbac
Update RNBraintreeDropInModule.java
mihailox Jan 19, 2021
1e7981a
Update RNBraintreeDropIn.m
mihailox Jan 19, 2021
adf4209
Adds a check for invalid client token
Mar 1, 2021
393b0fa
Update drop-in version and maven repository credentials
bpsourav21 Jul 11, 2021
f108c6b
Added issue reference
bpsourav21 Jul 11, 2021
7191b89
Update readme doc
bpsourav21 Aug 14, 2021
20194d1
Merge pull request #67 from beaur/master
wgltony Sep 18, 2021
dbc9b01
Merge pull request #62 from MihailoCherryz/adding-paypal-control
wgltony Sep 18, 2021
41bbeb8
Merge pull request #76 from bpsourav21/master
wgltony Sep 18, 2021
56e09fe
Fix paypal configuration attribute typo
ysudharsono Oct 26, 2021
8ff14fd
Merge pull request #79 from ysudharsono/patch-1
wgltony Oct 26, 2021
ceaf620
Update package.json
wgltony Oct 26, 2021
96910b2
fix: ios autolink not working
mlazari Jan 4, 2023
0b4977c
chore: update Braintree iOS SDK to v5
mlazari Jan 4, 2023
34ada90
chore: update Braintree Android SDK to v4
mlazari Jan 4, 2023
5fd72b3
chore: update index.js.flow
mlazari Jan 6, 2023
e44ad0f
chore: update README
mlazari Jan 6, 2023
833b82c
feat: add fetchMostRecentPaymentMethod method
mlazari Jan 6, 2023
af56ae5
feat: add tokenizeCard method
mlazari Jan 6, 2023
88175e2
fix: fetchMostRecentPaymentMethod throwing an error instead of return…
mlazari Mar 2, 2023
af0ee48
chore: update Braintree dependencies
mlazari Mar 16, 2023
0e788e0
Merge pull request #98 from wbetterdev/wb
wgltony Apr 4, 2023
7e4f2ce
Update RNBraintreeDropIn.m
wgltony Apr 25, 2023
0215424
Update package.json
wgltony Apr 25, 2023
59ab74a
removed link to setup Android browser switch
May 18, 2023
5c7e05b
Merge pull request #108 from RyanLinXiang/remove-browser-switch-andro…
wgltony Aug 29, 2023
30b6b8a
Update Braintree SDK
Aug 29, 2023
0a8bb8d
version update
wgltony Aug 29, 2023
6dc32cd
readme update, disable credit card bug fixed
wgltony Sep 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 72 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,26 @@ IOS
```bash
npm install react-native-braintree-dropin-ui --save

OR

yarn add react-native-braintree-dropin-ui

cd ./ios
pod install
```

Android
```bash
npm install react-native-braintree-dropin-ui --save

OR

yarn add react-native-braintree-dropin-u
```

## Configurate Payment Method(For ALL RN VERSIONS)
See Braintree's documentation, [Apple Pay][8], [Google Pay][9], [Paypal][10], [Venmo][11]
Once you have finished setting up all the configurations, it will shows in the dropin UI.
See Braintree's documentation, [Apple Pay][7], [Google Pay][8], [Paypal][9], [Venmo][10]
Once you have finished setting up all the configurations, it will show in the dropin UI.


For React Native versions < 0.60
Expand All @@ -38,7 +46,7 @@ react-native link react-native-braintree-dropin-ui

#### iOS specific

You must have a iOS deployment target \>= 9.0.
You must have a iOS deployment target \>= 12.0.

If you don't have a Podfile or are unsure on how to proceed, see the [CocoaPods][1] usage guide.

Expand All @@ -58,7 +66,7 @@ pod 'Braintree'
pod 'BraintreeDropIn'

# comment the next line to disable Apple pay
pod 'Braintree/Apple-Pay'
pod 'Braintree/ApplePay'

# comment the next line to disable PayPal
pod 'Braintree/PayPal'
Expand All @@ -80,22 +88,33 @@ pod install

#### Apple Pay

The Drop-in will show Apple Pay as a payment option as long as you've completed the [Apple Pay integration][6] and the customer's [device and card type are supported][7].
The Drop-in will show Apple Pay as a payment option as long as you've completed the [Apple Pay integration][5] and the customer's [device and card type are supported][6].

#### PayPal

To enable paypal payments in iOS, you will need to add `setReturnURLScheme` to `launchOptions` of your `AppDelegate.m`
To enable paypal payments in iOS, you will need to add `setReturnURLScheme` to `launchOptions` of your `AppDelegate.m` / `AppDelegate.mm`

```objective-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[BTAppSwitch setReturnURLScheme:@"com.your-company-name.your-app-name.payments"]; // ADD THIS LINE
[BTAppContextSwitcher setReturnURLScheme:@"com.your-company-name.your-app-name.payments"]; // ADD THIS LINE
return YES;
}
```

#### Android specific

Note: Only complete these steps if using React Native versions < 0.60, autolinking will do these steps automatically.
Add in your `MainActivity.java`:
```
import tech.power.RNBraintreeDropIn.RNBraintreeDropInModule;

@Override
protected void onCreate(Bundle savedInstanceState) {
// ...
RNBraintreeDropInModule.initDropInClient(this);
}
```

Note: Only complete the next steps if using React Native versions < 0.60, autolinking will do these steps automatically.

Add in your `app/build.gradle`:

Expand Down Expand Up @@ -182,7 +201,7 @@ In your `AppDelegate.m`:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[BTAppSwitch setReturnURLScheme:self.paymentsURLScheme];
[BTAppContextSwitcher setReturnURLScheme:self.paymentsURLScheme];
...
}

Expand All @@ -191,7 +210,7 @@ In your `AppDelegate.m`:
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {

if ([url.scheme localizedCaseInsensitiveCompare:self.paymentsURLScheme] == NSOrderedSame) {
return [BTAppSwitch handleOpenURL:url options:options];
return [BTAppContextSwitcher handleOpenURL:url];
}

return [RCTLinkingManager application:application openURL:url options:options];
Expand All @@ -210,13 +229,13 @@ import Braintree

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
BTAppSwitch.setReturnURLScheme(self.paymentsURLScheme)
BTAppContextSwitcher.setReturnURLScheme(self.paymentsURLScheme)
...
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if let scheme = url.scheme, scheme.localizedCaseInsensitiveCompare(self.paymentsURLScheme) == .orderedSame {
return BTAppSwitch.handleOpen(url, options: options)
return BTAppContextSwitcher.handleOpen(url)
}
return RCTLinkingManager.application(app, open: url, options: options)
}
Expand All @@ -227,14 +246,9 @@ private var paymentsURLScheme: String {
}
```

##### Android

Setup [browser switch][4].


## Usage

For the API, see the [Flow typings][5].
For the API, see the [Flow typings][4].

### Basic

Expand All @@ -252,6 +266,7 @@ BraintreeDropIn.show({
googlePay: true,
applePay: true,
vaultManager: true,
payPal: true,
cardDisabled: false,
darkTheme: true,
})
Expand Down Expand Up @@ -284,6 +299,7 @@ BraintreeDropIn.show({
googlePay: true,
applePay: true,
vaultManager: true,
payPal: true,
cardDisabled: false,
darkTheme: true,
})
Expand All @@ -298,6 +314,36 @@ BraintreeDropIn.show({
});
```

### Fetch more recent payment method

```javascript
import BraintreeDropIn from 'react-native-braintree-dropin-ui';

BraintreeDropIn.fetchMostRecentPaymentMethod(clientToken)
.then(result => console.log(result))
.catch((error) => {
// Handle error
});
```

### Tokenize card

```javascript
import BraintreeDropIn from 'react-native-braintree-dropin-ui';

BraintreeDropIn.tokenizeCard(clientToken, {
number: '4111111111111111',
expirationMonth: '10',
expirationYear: '23',
cvv: '123',
postalCode: '12345',
})
.then(cardNonce => console.log(cardNonce))
.catch((error) => {
// Handle error
});
```

### Custom Fonts
```
BraintreeDropIn.show({
Expand All @@ -306,14 +352,14 @@ BraintreeDropIn.show({
boldFontFamily: 'Averta-Semibold',
})
```

[1]: http://guides.cocoapods.org/using/using-cocoapods.html
[2]: https://github.com/braintree/braintree-ios-drop-in
[3]: https://github.com/braintree/braintree-android-drop-in
[4]: https://developers.braintreepayments.com/guides/client-sdk/setup/android/v2#browser-switch-setup
[5]: ./index.js.flow
[6]: https://developers.braintreepayments.com/guides/apple-pay/configuration/ios/v4
[7]: https://articles.braintreepayments.com/guides/payment-methods/apple-pay#compatibility
[8]: https://developers.braintreepayments.com/guides/apple-pay/overview
[9]: https://developers.braintreepayments.com/guides/google-pay/overview
[10]: https://developers.braintreepayments.com/guides/paypal/overview/ios/v4
[11]: https://developers.braintreepayments.com/guides/venmo/overview
[4]: ./index.js.flow
[5]: https://developers.braintreepayments.com/guides/apple-pay/configuration/ios/v5
[6]: https://articles.braintreepayments.com/guides/payment-methods/apple-pay#compatibility
[7]: https://developers.braintreepayments.com/guides/apple-pay/overview
[8]: https://developers.braintreepayments.com/guides/google-pay/overview
[9]: https://developers.braintreepayments.com/guides/paypal/overview/ios/v5
[10]: https://developers.braintreepayments.com/guides/venmo/overview
18 changes: 9 additions & 9 deletions ios/RNBraintreeDropIn.podspec → RNBraintreeDropIn.podspec
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Pod::Spec.new do |s|
s.name = "RNBraintreeDropIn"
s.version = "1.0.0"
s.version = "1.1.6"
s.summary = "RNBraintreeDropIn"
s.description = <<-DESC
RNBraintreeDropIn
DESC
s.homepage = "https://github.com/bamlab/react-native-braintree-payments-drop-in"
s.license = "MIT"
# s.license = { :type => "MIT", :file => "../LICENSE" }
# s.license = { :type => "MIT", :file => "./LICENSE" }
s.author = { "author" => "[email protected]" }
s.platform = :ios, "9.0"
s.platform = :ios, "12.0"
s.source = { :git => "https://github.com/BradyShober/react-native-braintree-dropin-ui.git", :tag => "master" }
s.source_files = "*.{h,m}"
s.source_files = "ios/**/*.{h,m}"
s.requires_arc = true
s.dependency 'React'
s.dependency 'Braintree'
s.dependency 'BraintreeDropIn'
s.dependency 'Braintree/DataCollector'
s.dependency 'Braintree/Apple-Pay'
s.dependency 'Braintree/Venmo'
s.dependency 'Braintree', '5.20.1'
s.dependency 'BraintreeDropIn', '9.8.1'
s.dependency 'Braintree/DataCollector', '5.20.1'
s.dependency 'Braintree/ApplePay', '5.20.1'
s.dependency 'Braintree/Venmo', '5.20.1'
end
21 changes: 9 additions & 12 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:7.3.1'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
compileSdkVersion 33
buildToolsVersion '33.0.1'

defaultConfig {
minSdkVersion 21
targetSdkVersion 27
targetSdkVersion 33
versionCode 1
versionName "1.0"
}
Expand All @@ -32,21 +32,18 @@ repositories {
}

dependencies {
implementation 'com.braintreepayments.api:google-payment:3.2.0'
implementation 'com.google.android.gms:play-services-wallet:16.0.1'
implementation 'com.braintreepayments.api:data-collector:2.+'
implementation 'com.braintreepayments.api:drop-in:4.+'
implementation 'com.braintreepayments.api:drop-in:6.11.0'
implementation 'com.facebook.react:react-native:+'
}

// https://developers.braintreepayments.com/guides/3d-secure/migration/android/v3
rootProject.allprojects {
repositories {
maven {
url "https://cardinalcommerce.bintray.com/android"
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree-team-sdk@cardinalcommerce'
password '220cc9476025679c4e5c843666c27d97cfb0f951'
username 'braintree_team_sdk'
password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
}
}
}
Expand Down
Loading