A react native interface for integrating Braintree's native Drop-in Payment UI for Android using Braintree's v.zero SDK.
orignal verison from https://github.com/surialabs/react-native-braintree-android
-
git clone
-
Add the following to android/settings.gradle
include ':react-native-braintree'
project(':react-native-braintree').projectDir = new File(settingsDir, 'path/to/clone')
- Add the following to android/app/build.gradle
dependencies {
// ...
compile project(':react-native-braintree')
}
- Edit android/src/main/java/com/.../MainActivity.java
...
+ import com.mezzoky.rn.braintree.BraintreePackage;
public class MainActivity extends ReactActivity {
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
- new MainReactPackage()
+ new MainReactPackage(),
+ new BraintreePackage()
);
}
import Braintree from '../path/to/clone/index.android';
async function openBraintreeDropin(token: string) {
let ret;
try {
ret = await Braintree.paymentRequest(token)
} catch (e) {
ret = null
console.error(e)
}
return ret
}
const token = "eyJ2ZXJzaW9u..."
openBraintreeDropin(token)