Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/surialabs/react-native-braintree-android
A react native interface for integrating Braintree's native Drop-in Payment UI for Android
https://github.com/surialabs/react-native-braintree-android
Last synced: about 2 months ago
JSON representation
A react native interface for integrating Braintree's native Drop-in Payment UI for Android
- Host: GitHub
- URL: https://github.com/surialabs/react-native-braintree-android
- Owner: surialabs
- License: mit
- Created: 2015-12-11T10:00:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-13T06:55:01.000Z (over 8 years ago)
- Last Synced: 2024-11-14T02:50:16.503Z (2 months ago)
- Language: Java
- Size: 10.7 KB
- Stars: 25
- Watchers: 20
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react-native - react-native-braintree-android ★24 - Braintree's native Drop-in Payment UI for Android (Components / Integrations)
- awesome-react-native - react-native-braintree-android ★24 - Braintree's native Drop-in Payment UI for Android (Components / Integrations)
- awesome-react-native - react-native-braintree-android ★24 - Braintree's native Drop-in Payment UI for Android (Components / Integrations)
- awesome-react-native-ui - react-native-braintree-android ★16 - Braintree's native Drop-in Payment UI for Android (Components / Integrations)
- awesome-react-native - react-native-braintree-android ★24 - Braintree's native Drop-in Payment UI for Android (Components / Integrations)
README
# react-native-braintree-android
A react native interface for integrating Braintree's native Drop-in Payment UI for Android using [Braintree's v.zero SDK](https://developers.braintreepayments.com/start/overview).
## Setup
1. Add Braintree to your React Native project
```
npm install --save react-native-braintree-android
```2. Add the following to android/settings.gradle
```java
include ':react-native-braintree'
project(':react-native-braintree').projectDir = new File(settingsDir, '../node_modules/react-native-braintree-android')
```3. Add the following to android/app/build.gradle
```java
dependencies {
// ...
compile project(':react-native-braintree')
}
```4. Edit android/src/.../MainApplication.java
```java
// ...
import com.surialabs.rn.braintree.BraintreePackage; // <--
import android.content.Intent; // <--public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}@Override
protected List getPackages() {
return Arrays.asList(
new MainReactPackage(),
new BraintreePackage()
);
}};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
```## Usage
```js
import Braintree from 'react-native-braintree-android';
class Payment extends Component {
...componentDidMount() {
Braintree.setup(CLIENT_TOKEN)
}_paymentInit() {
Braintree.showPaymentViewController().then((nonce) => {
// Do something with nonce
});
}...
}```