Skip to content

Commit 8dcd928

Browse files
committed
init project
0 parents  commit 8dcd928

File tree

1,730 files changed

+108535
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,730 files changed

+108535
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Louis Lagrange
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# react-native-braintree-payments-drop-in
2+
3+
> React Native integration of Braintree Drop-in
4+
5+
## Getting started
6+
7+
```bash
8+
npm install react-native-braintree-dropin-ui --save
9+
```
10+
11+
### Mostly automatic installation
12+
13+
```bash
14+
react-native link react-native-braintree-dropin-ui
15+
```
16+
17+
#### iOS specific
18+
19+
You must have a iOS deployment target \>= 9.0.
20+
21+
If you don't have a Podfile or are unsure on how to proceed, see the [CocoaPods][1] usage guide.
22+
23+
In your `Podfile`, add:
24+
25+
```
26+
pod 'Braintree'
27+
pod 'BraintreeDropIn'
28+
pod 'Braintree/Apple-Pay'
29+
pod 'Braintree/PayPal'
30+
pod 'Braintree/Venmo'
31+
pod 'Braintree/DataCollector'
32+
33+
# uncomment the next line to support credit card scanning
34+
pod 'CardIO'
35+
36+
```
37+
38+
Then:
39+
40+
```bash
41+
cd ios
42+
pod repo update # optional and can be very long
43+
pod install
44+
```
45+
46+
#### Android specific
47+
48+
Add in your `app/build.gradle`:
49+
50+
```
51+
dependencies {
52+
...
53+
implementation "io.card:android-sdk:5.+"
54+
implementation 'com.braintreepayments.api:data-collector:2.+'
55+
```
56+
57+
### Configuration
58+
59+
For more configuration options, see Braintree's documentation ([iOS][2] | [Android][3]).
60+
61+
#### 3D Secure
62+
63+
If you plan on using 3D Secure, you have to do the following.
64+
65+
##### iOS
66+
67+
###### Configure a new URL scheme
68+
69+
Add a bundle url scheme `{BUNDLE_IDENTIFIER}.payments` in your app Info via XCode or manually in the `Info.plist`.
70+
In your `Info.plist`, you should have something like:
71+
72+
```xml
73+
<key>CFBundleURLTypes</key>
74+
<array>
75+
<dict>
76+
<key>CFBundleTypeRole</key>
77+
<string>Editor</string>
78+
<key>CFBundleURLName</key>
79+
<string>com.myapp</string>
80+
<key>CFBundleURLSchemes</key>
81+
<array>
82+
<string>com.myapp.payments</string>
83+
</array>
84+
</dict>
85+
</array>
86+
```
87+
88+
###### Update your code
89+
90+
In your `AppDelegate.m`:
91+
92+
```objective-c
93+
#import "BraintreeCore.h"
94+
95+
...
96+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
97+
{
98+
...
99+
[BTAppSwitch setReturnURLScheme:self.paymentsURLScheme];
100+
}
101+
102+
- (BOOL)application:(UIApplication *)application
103+
openURL:(NSURL *)url
104+
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
105+
106+
if ([url.scheme localizedCaseInsensitiveCompare:self.paymentsURLScheme] == NSOrderedSame) {
107+
return [BTAppSwitch handleOpenURL:url options:options];
108+
}
109+
110+
return [RCTLinkingManager application:application openURL:url options:options];
111+
}
112+
113+
- (NSString *)paymentsURLScheme {
114+
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
115+
return [NSString stringWithFormat:@"%@.%@", bundleIdentifier, @"payments"];
116+
}
117+
```
118+
119+
##### Android
120+
121+
Setup [browser switch][4].
122+
123+
124+
## Usage
125+
126+
For the API, see the [Flow typings][5].
127+
128+
### Basic
129+
130+
```javascript
131+
import BraintreeDropIn from 'react-native-braintree-payments-drop-in';
132+
133+
BraintreeDropIn.show({
134+
clientToken: 'token',
135+
merchantIdentifier: 'applePayMerchantIdentifier',
136+
countryCode: 'US', //apple pay setting
137+
currencyCode: 'USD', //apple pay setting
138+
merchantName: 'Your Merchant Name for Apple Pay',
139+
orderTotal:'Total Price',
140+
googlePay: true,
141+
applePay: true,
142+
})
143+
.then(result => console.log(result))
144+
.catch((error) => {
145+
if (error.code === 'USER_CANCELLATION') {
146+
// update your UI to handle cancellation
147+
} else {
148+
// update your UI to handle other errors
149+
}
150+
});
151+
```
152+
153+
### 3D Secure
154+
155+
```javascript
156+
import BraintreeDropIn from 'react-native-braintree-payments-drop-in';
157+
158+
BraintreeDropIn.show({
159+
clientToken: 'token',
160+
threeDSecure: {
161+
amount: 1.0,
162+
},
163+
})
164+
.then(result => console.log(result))
165+
.catch((error) => {
166+
if (error.code === 'USER_CANCELLATION') {
167+
// update your UI to handle cancellation
168+
} else {
169+
// update your UI to handle other errors
170+
// for 3D secure, there are two other specific error codes: 3DSECURE_NOT_ABLE_TO_SHIFT_LIABILITY and 3DSECURE_LIABILITY_NOT_SHIFTED
171+
}
172+
});
173+
```
174+
175+
[1]: http://guides.cocoapods.org/using/using-cocoapods.html
176+
[2]: https://github.com/braintree/braintree-ios-drop-in
177+
[3]: https://github.com/braintree/braintree-android-drop-in
178+
[4]: https://developers.braintreepayments.com/guides/client-sdk/setup/android/v2#browser-switch-setup
179+
[5]: ./index.js.flow

android/.idea/gradle.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/misc.xml

+33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)