react-native-odde-alipay
React Native Module for alipay.com. This is a fork of react-native-yunpeng-alipay (I can't find a public repo of it, therefore start over with what I can get from npm). Although some new feature has been added on top of it, all honor should go to react-native-yunpeng-alipay.
install
yarn add react-native-odde-alipay
Android
With react-native
react-native link react-native-odde-alipay
Manually
- android/settings.gradle
include ':react-native-odde-alipay'
project(':react-native-odde-alipay').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-odde-alipay/android')
- android/app/build.gradle
dependencies {
compile project(':react-native-odde-alipay')
}
- register module (in MainActivity.java)
... // <--- IMPORT
iOS
With react-native
react-native link react-native-odde-alipay
Manually
Link
AlipayModule
library from yournode_modules/react-native-odde-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":
- CoreMotion.framework
- CoreTelephony.framework
- libc++
- 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
;
Alipay;
Use Alipay Sandbox (Android only)
Alipay;
For more detail about sandbox, please refer to this link.