Linking
react-native cli
Run react-native link tipsi-stripe
so your project is linked against your Xcode project and all CocoaPods dependencies are installed.
iOS
CocoaPods
Setup your Podfile
like the included example/ios/Podfile then run pod install
.
Open your project in Xcode workspace.
Drag the following folder into your project:
node_modules/tipsi-stripe/ios/TPSStripe/
Manual
Open your project in Xcode, right click on Libraries and click Add Files to "Your Project Name"
.
Look under
node_modules/tipsi-stripe/ios
and addTPSStripe.xcodeproj
.Add
libTPSStripe.a
toBuild Phases
→Link Binary With Libraries
.Click on
TPSStripe.xcodeproj
in Libraries and go theBuild Settings
tab.
Double click the text to the right ofHeader Search Paths
and verify that it has$(SRCROOT)/../../react-native/React
${SRCROOT}/../../../ios/Pods/Headers/Public
If they aren't, then add them. This is so Xcode is able to find the headers that the
TPSStripe
source files are referring to by pointing to the header files installed within thereact-native
node_modules
directory.Whenever you want to use it within React code now you can:
import stripe from 'tipsi-stripe'
Android
Manual
In your android/app/build.gradle
add:
...
dependencies {
...
+ compile project(':tipsi-stripe')
}
In yourandroid/settings.gradle
add:
...
+include ':tipsi-stripe'
+project(':tipsi-stripe').projectDir = new File(rootProject.projectDir, '../node_modules/tipsi-stripe/android')
In yourandroid/build.gradle
add:
...
allprojects {
repositories {
...
+ maven { url "https://jitpack.io" }
}
}
In your android/app/src/main/java/com/%YOUR_APP_NAME%/MainApplication.java
add:
...
+ import com.gettipsi.stripe.StripeReactPackage;
...
protected List <ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
- new MainReactPackage()
+ new MainReactPackage(),
+ new StripeReactPackage()
);
}
Ensure that you have Google Play Services installed.
Genymotion
For Genymotion
you can follow these instructions.
For a physical device you need to search on Google for 'Google Play Services'. There will be a link that takes you to the Play Store
and from there you will see a button to update it (do not search within the Play Store
).