react-native-jsunc-alipay
v1.0.1
Published
a new alipay package
Downloads
3
Readme
react-native-jsunc-alipay
React Native Module for alipay.com
install
npm install react-native-jsunc-alipay --save
Android
With react-native link
react-native link react-native-jsunc-alipay
Manually
- android/settings.gradle
include ':react-native-jsunc-alipay'
project(':react-native-jsunc-alipay').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-jsunc-alipay/android')
- android/app/build.gradle
dependencies {
compile project(':react-native-jsunc-alipay')
}
- register module (in MainActivity.java)
...
import com.jsunc.alipay.AlipayPackage; // <--- IMPORT
public class MainActivity extends ReactActivity {
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new AlipayPackage() // <--- ADD HERE
);
}
}
iOS
With react-native link
react-native link react-native-jsunc-alipay
Manually
Link
AlipayModule
library from yournode_modules/react-native-jsunc-alipay/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
- Make sure you have these code in AppDelegate.m to enable callback
#import "AlipayModule.h"
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
[AlipayModule handleCallback:url];
return YES;
}
General Usage
import Alipay from 'react-native-jsunc-alipay';
Alipay.pay("signed pay info string").then(function(data){
console.log(data);
}, function (err) {
console.log(err);
});