bt-react-native
v0.0.6
Published
## Getting started
Downloads
15
Maintainers
Readme
bt-react-native
Getting started
$ npm install bt-react-native --save
Mostly automatic installation
$ react-native link bt-react-native
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜bt-react-native
and addRNBraintree.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNBraintree.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNBraintreePackage;
to the imports at the top of the file - Add
new RNBraintreePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':bt-react-native' project(':bt-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/bt-react-native/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':bt-react-native')
Usage
import RNBraintree from 'bt-react-native';
// TODO: What to do with the module?
RNBraintree.addToken(string: <Gateway Token From Server>);
/* Result
* {nonce: "", type: "visa", isDefault: true, description: "...card ending in 1111"}
*/
let btResult = RNBraintree.fetchNonce({
name: "Home Simpson",
number: "4111111111111111",
expMonth: "12",
expYear: "2020",
cvc: "123"
});