react-native-alipays
v1.0.1
Published
alipay module for react native
Downloads
11
Readme
react-native-alipays
React Native Module for alipay.com
install
yarn add react-native-alipays
Android
react-native link react-native-alipays
- edit android/build.gradle
repositories {
flatDir {
dirs project(':react-native-alipays').file('libs')
}
}
Manually
- android/settings.gradle
include ':react-native-alipays'
project(':react-native-alipays').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-alipays/android')
- android/app/build.gradle
dependencies {
compile project(':react-native-alipays')
}
- register module (in MainActivity.java)
...
import com.alipay.AlipayPackage; // <--- IMPORT
public class MainActivity extends ReactActivity {
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new AlipayPackage() // <--- ADD HERE
);
}
}
iOS
RN > 0.6.0
pod install
With rnpm
react-native link react-native-alipays
Manually
Link
AlipayModule
library from yournode_modules/react-native-alipays/ios
folder like its described here. Don't forget to add it to "Build Phases" of project.
Config
- Added the following libraries to your "Link Binary With Libraries":
- [x] CoreMotion.framework
- [x] CoreTelephony.framework
- [x] libc++
- [x] libz
- add
URL Schema
as your app id forURL type
inTargets - info
General Usage
import Alipay from 'react-native-alipays';
Alipay.pay("signed pay info string"), data => {
console.log(data);
};