Skip to content

mkchung/react-native-alipay-no-utdid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-alipay-no-utdid

React Native Module for alipay.com

install

npm install git+https://github.com/mkchung/react-native-alipay-no-utdid.git --save

Android

With rnpm

rnpm link react-native-alipay-no-utdid

Manually

  • android/settings.gradle
include ':react-native-alipay-no-utdid'
project(':react-native-alipay-no-utdid').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-alipay-no-utdid/android')
  • android/app/build.gradle
dependencies {
    compile project(':react-native-alipay-no-utdid')
}
  • register module (in MainActivity.java)
...

import com.yunpeng.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 rnpm

rnpm link react-native-alipay-no-utdid

Manually

Link AlipayModule library from your node_modules/react-native-alipay-no-utdid/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 for URL type in Targets - 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-alipay-no-utdid';
Alipay.pay("signed pay info string").then(function(data){
                    console.log(data);
                }, function (err) {
                    console.log(err);
                });

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published