Linking
Note Linking on Windows system currently isn't working. Feel free to fix it and remove this warning from docs
Automatically
Run react-native link tipsi-stripe
so your project is linked
against your Xcode project and all CocoaPods dependencies are installed.
Manual
iOS
-
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
In your android/app/build.gradle
add:
...
dependencies {
...
+ compile project(':tipsi-stripe')
}
In your android/settings.gradle
add:
...
+include ':tipsi-stripe'
+project(':tipsi-stripe').projectDir = new File(rootProject.projectDir, '../node_modules/tipsi-stripe/android')
In your android/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()
);
}
If enabling minification in your app/build.gradle
file, you must
also add the following line to proguard-rules.pro
:
+ -keep class com.stripe.android.** { *; }
You can check Stripe Android SDK for detail.
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
).