To use this library you will need to be approved for the in-app provisioning entitlements from Apple and Google.
$ npm install react-native-payment-pass --save (Coming soon)
Autolinking will just do the job.
$ react-native link react-native-payment-pass
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-payment-passand addRNPaymentPass.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNPaymentPass.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNPaymentPassPackage;to the imports at the top of the file - Add
new RNPaymentPassPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-payment-pass' project(':react-native-payment-pass').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-payment-pass/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-payment-pass')
import RNPaymentPass from 'react-native-payment-pass'
try {
const canAddPass = await RNPaymentPass.canAddPaymentPass()
if (canAddPass) {
RNPaymentPass.addPaymentPass('Joe Smith', '1234')
}
} catch (error) {
console.log(error)
}